Trying to Calculate a Jump Arc (Kinematic Equation Needed?)

Hi all. I’m working on a 2D platformer based on this guy’s (amazing) tutorial series. I plan to study, extend, and shift his controller around until I have something that works for me. Important note- it’s made without Unity rigidbodies. Everything is coded from scratch, and the only Unity physics-related system it relies on is raycasting (for collision checking).

Anyway, there’s something I’ve been trying to understand for a while, and that’s how to calculate a jump that would get a character from a point A to a point B, but with a realistic arc instead of a straight interpolation. Here’s a drawing:

That’s what I had in mind. One more note about it: this jump will be independent of player input as it’s happening. Once the jump is initiated, it continues until it’s finished, and at that point control is returned to the player, so there’s no worrying about how this will interact with character control. It’s a different ‘type’ of jump than a standard platformer jump, so it behaves differently. It’s like an auto jump that the player can use in certain scenarios.

I’m hoping there’s some sort of physics equation out there that could help me calculate the arc, so I thought I’d come here since my knowledge of physics is okay at best. Can anyone help me? I’d really appreciate it :slight_smile: Even pointing me to an article or two would help.

Do you want to know exactly when your character will land or just calculate the jump in real time.
If just the second, the whole process should be simple and will require adding few vectors every frame during jump

if (pressX)
{
    fall = 0;
    speed = yourcurrentspeed;
    jump = true;
    drag = 0;
}

if (jump)
{
    drag = -speed * dragmultiplier * Time.DeltaTime;
    fall -= -9,8 * Time.DeltaTime;
    transform.position += new Vector2(speed*Time.DeltaTime, jumpSpeed * Time.DeltaTime) + new Vector2(drag, fall);
}

Now, if you put these calculations in a loop and replace transform.position with some temporary Vector2 you will get the jump trajectory.
If you want to calculate how much speed and force you need to complete the jump you can use these equations: Trajectories

1 Like