Jump to content
• Advertisement

# Realistic Jumping Physics [RESOLVED]

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

If you intended to correct an error in the post then please contact us.

## 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 this post

##### Share on other sites
Advertisement
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 this post

##### 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 this post

##### 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 this post

##### 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 this post

##### 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 this post

##### 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 this post

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

#### Share this post

##### 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 this post

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

I had these variables setup when the program loads:

    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 this post

##### Share on other sites

• Advertisement

### Announcements

• Advertisement

• ### Popular Contributors

1. 1
2. 2
3. 3
Rutin
15
4. 4
khawk
14
5. 5
frob
12
• Advertisement

• 9
• 11
• 11
• 23
• 12
×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!