Raised This Month: $ Target: $400
 0% 

[solved]gravity math!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
frk_14
Senior Member
Join Date: Jan 2009
Location: Argentina
Old 03-16-2011 , 00:03   [solved]gravity math!
Reply With Quote #1

someone know how is the calculation (i dont know if is the correct word) that uses the engine to imitate the gravity in game?
i need to predict how many speed need set to a entity to proximity to "X" height

Last edited by frk_14; 03-16-2011 at 21:35.
frk_14 is offline
Send a message via MSN to frk_14 Send a message via Skype™ to frk_14
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 03-16-2011 , 01:19   Re: gravity math!
Reply With Quote #2

Check these links out.

http://forums.alliedmods.net/showthr...t=gravity+math
http://en.wikipedia.org/wiki/Trajectory_of_a_projectile
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-16-2011 , 03:05   Re: gravity math!
Reply With Quote #3

Code:
Float:GetHeightVelocity(ent, Float:height) {     static sv_gravity;     if(sv_gravity || (sv_gravity = get_cvar_pointer("sv_gravity")))     {         return floatsqroot(2.0 * get_pcvar_float(sv_gravity) * entity_get_float(ent, EV_FL_gravity) * height);     }     return 0.0; }

Usage:
Code:
new Float:velocity[3]; entity_get_vector(id, EV_VEC_velocity, velocity); velocity[2] = GetHeightVelocity(id, 500.0); // send player up 500 units entity_set_vector(id, EV_VEC_velocity, velocity);

Use this site as a reference for some more gravity calculations:
http://home.roadrunner.com/~sccinfo/scigrav.htm
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
frk_14
Senior Member
Join Date: Jan 2009
Location: Argentina
Old 03-16-2011 , 21:32   Re: gravity math!
Reply With Quote #4

thanks, is really useful.
frk_14 is offline
Send a message via MSN to frk_14 Send a message via Skype™ to frk_14
Reply



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 14:31.


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