I'm trying to make a character jump on a landing pad who stays above him. Here is the formula I've used (everything is pretty much self-explainable, maybe except character_MaxForce that is the total force the character can jump):

deltaPosition = target - character_position;
sqrtTerm = Sqrt(2 * -gravity.y * deltaPosition.y + MaxYVelocity * character_MaxForce);
time = (MaxYVelocity - sqrtTerm) / gravity.y;
speedSq = jumpVelocity.x * jumpVelocity.x + jumpVelocity.z * jumpVelocity.z;

If speedSq < (character_MaxForce * character_MaxForce) we have the right time so we can store the value:

jumpVelocity.x = deltaPosition.x / time;
jumpVelocity.z = deltaPosition.z / time;

Otherwise we try the other solution:

time = (MaxYVelocity + sqrtTerm) / gravity.y;

and then store it:

jumpVelocity.x = deltaPosition.x / time;
jumpVelocity.z = deltaPosition.z / time;
jumpVelocity.y = MaxYVelocity;

rigidbody_velocity = jumpVelocity;

The problem is that the character is jumping away from the landing pad or sometime he jumps too far never hitting the landing pad.

• You know whether the landing path is left or right by comparing the "x" value. Or you could simply calculate a default trajectory between the two pads. But if you don't want to couple the jump and landing pads then you could simply specify a direction vector in your jump pad and a scalar ( a multiplier ) that acts as a velocity to your character making him jump in a certain direction. Tweaking the scalar and riection should give you the right trajectory. Sep 26 '12 at 23:17
• And by default trajectory I mean using a Quadratic Bezier curve. You know the starting point(jump pad) and the end point(landing pad). Using the control point, which can never be lower than the highest pad, to define your "curve". en.wikipedia.org/wiki/B%C3%A9zier_curve Look at the quadratic formula, it's very simple. ( this will only give you the curve though) Using "t" to trace the curve (which is between 0 an 1 ) Sep 26 '12 at 23:23
• Man I love the game dev because they have always a simple but smart solution thanks a lot man, I will try to implement this and let you now :D Sep 27 '12 at 8:50
• @Sidar you should post all this as an answer. Nov 26 '12 at 9:26