Jump to content

  • Log In with Google      Sign In   
  • Create Account

Jump math


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 doyleman77   Members   -  Reputation: 366

Like
0Likes
Like

Posted 27 August 2011 - 09:43 PM

I was trying to figure what equation would be best related to jumping, and for whatever reason i'm convinced it is related to the parabola quadratic equation; which I also don't see how it could work (maybe i'm looking at it the wrong way?)

Anyway, would anyone be as kind as to tipping me off in the right direction for figuring what the players height of jump should be based off of x-Time if button is held?

Sponsor:

#2 japro   Members   -  Reputation: 887

Like
1Likes
Like

Posted 28 August 2011 - 02:53 AM

Usually this is done per time step. In mathspeak: you integrate the equations of motion with explicit Euler method. So each time step you do:
acceleration = -g + other accelerations + Forces/m;
velocity += acceleration*dt;
position += velocity*dt;
With dt being the time step. So if you want to jump you can simply modify the velocity value or add a force. Basically you do something along the lines:
if(button pressed)
   other accelerations = some value;
You obviously still have to modify this so the player can't accelerate up by holding the jump button indefinitely.

So as long as there are no other forces and accelerations this will make the players movement approximate a parabola automatically.

#3 wildbunny   Members   -  Reputation: 550

Like
1Likes
Like

Posted 28 August 2011 - 05:25 AM

From Newton's equations of motion:

http://en.wikipedia.org/wiki/Equations_of_motion


Posted Image


So, si is your position on the current frame, vi is your velocity and a is your acceleration (gravity and other forces) and t is the time. Just plug in the numbers :)


Cheers, Paul.

#4 doyleman77   Members   -  Reputation: 366

Like
0Likes
Like

Posted 28 August 2011 - 12:51 PM

Hey, thanks guys! I was way off on what I need to have been doing. I'll toss this in, and see if I need to do any tweaking. :) thanks again

#5 sooner123   Members   -  Reputation: 241

Like
0Likes
Like

Posted 29 August 2011 - 02:43 PM

Hey, thanks guys! I was way off on what I need to have been doing. I'll toss this in, and see if I need to do any tweaking. :) thanks again


You will need to do some tweaking. To the initial velocity of the jump or the acceleration due to gravity.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS