Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1075922 Posts in 44152 Topics- by 36120 Members - Latest Member: Royalhandstudios

December 29, 2014, 03:46:01 PM
TIGSource ForumsDeveloperTechnical (Moderators: Glaiel-Gamer, ThemsAllTook)Gravity Sim
Pages: [1]
Print
Author Topic: Gravity Sim  (Read 813 times)
theman515
Level 0
**


The code... the code!!


View Profile WWW Email
« on: April 16, 2011, 10:55:16 PM »

hey guys, i was wondering how to simulate a jump based on physics and weight. IE if a guy that weighs 200 pounds jump he would not jump as high as a guy weigh 100 pounds.

my game is of course assuming that the upwards force is a constant. or am i making this way too complicated and just make it a x+=#?

please and thank you!  Beer!
Logged
SirEel
Level 0
**


View Profile
« Reply #1 on: April 17, 2011, 03:24:42 AM »

well, to do that you probably need a force type model, which means when jumping apply some force F over an amount of time (instantaneous force could work too, I guess) and F = ma, which is force = mass * acceleration. so Force/mass = acceleration. As acceleration needs time to actually bring the velocity up, you may want to kludge it instead.

Work out a time to apply acceleration over, then v = (Ft)/m, so just use some value like 0.5 for t, and use whatever your jump force is for F (sign should match that of v, so make it point upwards) and you're done!
Logged
theman515
Level 0
**


The code... the code!!


View Profile WWW Email
« Reply #2 on: April 17, 2011, 11:36:45 AM »

so would V be what i add to y?
Logged
SirEel
Level 0
**


View Profile
« Reply #3 on: April 17, 2011, 12:36:01 PM »

essentially, yes. the way I'd write it, v would be what you add to your position, but it doesn't matter. Essentially, if you use force as a vector, v will be a vector. if force is just the magnitude of force, v will be a speed, in the direction of that force. Hope that helps!
Logged
theman515
Level 0
**


The code... the code!!


View Profile WWW Email
« Reply #4 on: April 18, 2011, 04:04:31 PM »

thanks man. you've been a great help!  Beer!
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic