A question for the mathematically inclined!

I want to make a character jump. I know the time between taking off and landing, I know the distance between the start and end positions, and I know the jump height. Is there an algorithm I can use to calculate the character’s position at any point along the jump’s path using a normalized 0 - 1 time variable?

I also need to be able to calculate the gravity, based on the time/height of the jump.

I’ve done a fair bit of googling, and I found a couple of algorithms written in scientific notation but I have NO IDEA how to read that ><

What code/method do you use to integrate the jump?

What do you mean by calculate the gravity? Is gravity not constant in your game world?

My game isn’t real-time. I’m simply animating a jump between two locations, and the only variables I know are:

- The distance of the jump
- The height of the jump
- The time that the character is airborn

All of these things need to stay constant for design and style reasons.

The ground is flat, so the character isn’t landing higher or lower than they launch.

I’m trying to build a method like:

Vector3 GetJumpPosition(float normalizedTime);

where a value between 0 and 1 is passed in, and the method returns a position on the ‘path’ of the jump.

In that case look into programming curves and splines. You’d define several control points then you can simply feed in the time parameter and you’ll get the position along that curve at that time. There are lots of different spline methods you could use, quadratic, cubic, hermite ect - which is best will depend on the game, visual preference ect.

You might even be able to use something like iTween for this but I’ve never used it myself so I wouldn’t know.

Great suggestion, thankyou! That would certainly be much easier!