# Realistic Jumping Physics [RESOLVED]

This topic is 4378 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I want to be able to do realistic time based jumping physics, with air resistance. And I know that mass is cancelled out in the actual equation, but I also want to be able to somehow, allow heavy sprites to not jump so high, and light sprites to jump high. Any ideas on how I can pull this one off? [Edited by - Jacob Roman on December 17, 2005 2:21:14 PM]

##### Share on other sites
Think about how the jumping begins. A force is applied, and this causes the object (animal, human, whatever) to accelerate upwards. The acceleration is given basically by force = ma, that is, acceleration = force/mass. So, applying the same force to a more massive object results in less net acceleration. Less acceleration means a lower velocity is achieved. Once the applied force stops---feet in the air, only gravity applies. The rest of the jump is just deceleration by gravity and falling back down. If starting the freefall portion from a lower after-acceleration velocity, then the height reached in the jump will be less. So...it can be handled naturally I think.

##### Share on other sites
In other words... you can vary the initial velocity, which (with a fixed force and duration) will be inversely proportional to the mass -- v0 = k/m.

##### Share on other sites
So I divide the inverse of a constant initial velocity by the sprites mass? Seems to make sence. Like if 10 were the constant initial velocity, and mass were 100

Inverse_v0 = 1/10 = .1
.1/100 = 0.001

But when the mass is 10:
.1/10 = 0.01

...the initial velocity is greater.

##### Share on other sites
I would say that u could model something like that by giving urself and initial velocity and then use F=ma formula to find out ur accceleration down and then do something like this:
x=xoriginal +Voriginalt+1/2at^2
Note this is clean physical stuff that i got from a book that i bought(Haliday and resnick or something like that), and if it is any good for modeling i am not sure but i would think you could make it work, btw i am new at this so take this info with some salt as i might be wrong.
Also you could make ur initial velocity dynamic once again using the F=ma formula and then just getting the veolocity of the object under acceleration.

##### Share on other sites
Really, grhodes_at_work is giving you the right idea. If you treat jumping as the application of an initial impulse J, then you can arrive at an initial velocity v0 like this:

F = m * a -> a = F / m
if the impulse of jumping is J, then F = J.
a = J / m;

But because this is a very simplified example of impulse, we can disregard the equation:
v = v0 + a*t = (J / m) * t
Instead, assume that v = J/m.

After the initial application of impulse, use the proper equations:

F = ma = mg = -9.8*m
a = -9.8;

v = v0 + a*t = (J/m) + -9.8*t;

or
v = J/m;v += -9.8*t;

This will produce shorter jumps for massive objects, and higher jumps for less massive objects when the same impulse J is applied.
HTH

edit: I should note that -9.8 for g is meters per second squared.

##### Share on other sites
What about v = v0 + J/M * t? Seemed like you forgot about the initial velocity, but I'm not sure if it got cancelled it in some way. Doesn't seem as though it has at all.

Wait a minute, unless J/M is the initial velocity. Is it?

##### Share on other sites
isn;t v0 initial velocity?

##### Share on other sites
This is a case that is best treated as an impulse (rapid application of force). In this situation, we'll treat impulse as instantaneous application of force. This means that the force is applied as the initial situation, and then the object is advanced as usual from there.

The application of this force will cause an instantaneous acceleration of F/m (or specifically, J/m). An instantaneous acceleration applied to a vertically stationary object (v0=0) yields an instantaneous vertical velocity of J/m. From then on, we can treat v0 as J/m, yielding the equation I submitted.

##### Share on other sites
Awesome, I got it now!

    p.X = 150        'X Position    p.Y = 200        'Y Position    p0.Y = 200       'Initial Position    f = 50           'Force    m = 10           'Mass    v0 = f / m       'Initial velocity    a = -GRAVITY     'Acceleration

Then in the game loop, I did this:

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)    If KeyCode = vbKeySpace And Jump = False Then            Milliseconds = Get_Elapsed_Seconds            Jump = True        End IfEnd SubPrivate Sub Timer1_Timer()    Cls        If Jump = True Then            If p.Y > p0.Y Then                        p.Y = p0.Y                Jump = False            Else                    t = Get_Elapsed_Seconds - Milliseconds                    v = v + (v0 + a * t)                        p.Y = p0.Y - v            End If            End If        Draw_SpriteEnd Sub

Thanks everyone! Problem is resolved!

##### Share on other sites

This topic is 4378 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628647
• Total Posts
2984034

• 10
• 9
• 9
• 10
• 21