# smooth jumping?

Hi guys! I have a game where you jump using a series of intervals (I the used the code from here.

bpaste.net/show/ysGZeeIKUyYMZWCj5yoV/

So what I want is so that when he jumps up he doesn’t go up at the same speed and then suddenly stop and come back down what I want is it to go up and then slowly slow down until you get to the top then you slowly speed up as you go down to hit the ground at the same speed that you started going up at. To do this would it be entirely mathematical or will I have to use some functions that were built into panda and could you also please give me an example or something because if it is entirely mathematical I can’t think of a way you would be able to do it.[/url]

How about using a Function Interval that uses something Sinus like (in 0…PI)?

Jumping is parabolic, not sinusoidal. Remember high school physics class, z = 0.5 * g * (t**2). g is known, it is on average 9.81 m/s/s on earth, so you can calculate the required z of the model.

Or you could properly simulate the accelerations involved in a task, which should be just as simple.

No math needed. LerpPosInterval has a optional parameter blendType. Just set blendType=‘easeOut’ for the going up part of the jump and blendType=‘easeIn’ for going down.
www.panda3d.org/manual/index.php/Lerp_Intervals

It looks quite similar, but your method is probably faster to calculate, rdb.

Here a comparison for both formulae (jump height 1 and time 1)
wolframalpha.com/input/?i=-4%28x-0.5%29^2%2B1+in+range+0…1
wolframalpha.com/input/?i=si … range+0…1

What kind of easing do LerpIntervals use? Is it cubic? If it’s quadratic, then it’s basically what rdb said under the hood.

EDIT: looks like the parabolic URI can’T be parsed by the forum software. You’ll have to copy’n’paste the whole url into a new tab.

thanks guys I’m sure one of these will work.