Raised This Month: $ Target: $400
 0% 

velocity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SubFive
Senior Member
Join Date: Dec 2005
Location: USA
Old 12-11-2005 , 04:14   velocity
Reply With Quote #1

Could someone tell me the specifics of get_user_velocity? I've searched the doc and the forums and both have very little information about it.

I understand:
Code:
if (Velocity[0] == 0 && Velocity[1] == 0 && Velocity[2] == 0)
What do each one of those represent though?

Is [0] x, [1] y, and [2] z?
SubFive is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 12-11-2005 , 06:58  
Reply With Quote #2

Yes. Velocity may be negative value. Since origin may be negative either.

EDIT:
I think this values have dimension unit like [distance_units per second]
VEN is offline
SubFive
Senior Member
Join Date: Dec 2005
Location: USA
Old 12-11-2005 , 14:53  
Reply With Quote #3

So correct me if I'm wrong, but wouldn't someones (z) velocity be at about 0 if they were at the peak of a jump? Wouldn't their velocity (z) be at exactly 0 if they weren't jumping at all? How can I distinguish between the two?
SubFive is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 12-11-2005 , 19:19  
Reply With Quote #4

Search for a negative velocity which means they are going upwards. Once you know they are going upwards check to see when their velocity nears 0. Tada. Also use EV_FL_flFallVelocity.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
SubFive
Senior Member
Join Date: Dec 2005
Location: USA
Old 12-11-2005 , 19:23  
Reply With Quote #5

Thanks again, both of you! I'll be honest though and say I don't exactly know how to use EV_FL_flFallVelocity.
SubFive is offline
SubFive
Senior Member
Join Date: Dec 2005
Location: USA
Old 12-12-2005 , 00:52  
Reply With Quote #6

Could you please confirm the following?

If they aren't jumping or moving vertically, their z velocity is 0. If they are at the exact peak of a jump and aren't moving up or down anymore for a split second, their z velocity is also at 0, isn't it?

So what goes in between?
When you jump, is your z velocity immediately about -20 (or whatever the actual number for the peak of a jump is, or is it graduate?

For example:
Graduate:
http://server2.ihostphotos.com/show.php?id=36693

Immediate:
http://server2.ihostphotos.com/show.php?id=36695

I'm pretty confused, my brain hurts, and I'm not great at physics. Could someone please enlighten me on this? To make it simple, I just want an if statement that catches what the user's z velocity is, and if hes near the top of a jump, to do something.
SubFive is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 12-12-2005 , 01:11  
Reply With Quote #7

Yes, you are falling at a speed of 0.0 while on the ground and reach 0.0 while at the peak of your jump (not exactly, but very close). So, you have to make sure the user jumped first, check for when they slow down, and make sure that once you acknowledge they slowed down you don't check anymore (ie: so it doesn't get called again when they hit the ground).

Tested, works fine:

Code:
#include <amxmodx>  #include <engine>  new bool:didJump[33];  new bool:didPeak[33];  public client_PreThink(id) {     if( !is_user_alive(id) )         return;     if( (get_user_button(id) & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !didJump[id] )         didJump[id] = true;     else if( (get_entity_flags(id) & FL_ONGROUND) && didJump[id] ) {         didJump[id] = false;         didPeak[id] = false;     }  }  public client_PostThink(id) {     if( !didJump[id] || didPeak[id] )         return;     new Float:fall = entity_get_float(id,EV_FL_flFallVelocity);     if( fall >= -5.0 && fall < 5.0 ) {         didPeak[id] = true;         peak(id);     }  }  public peak(id) {     client_print(id,print_chat,"* PEAK!");  }
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
SubFive
Senior Member
Join Date: Dec 2005
Location: USA
Old 12-12-2005 , 18:54  
Reply With Quote #8

Thanks for your post Avalance, you're very helpful.

Thats a lot to digest, especially without comments, so I'll get back to you because I'll probably run into trobule figuring out how to intergrade that into my script. Thanks again. +kudos, +karma, +etc.
SubFive is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:11.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode