What's the best way to predict the landing location of a jump?

I’m trying to determine, before allowing a character to jump, where they will land. I’m going to change the behavior of the jump, based on the results of this prediction. What’s the best way to predict the landing location of a character who is about to have some jump velocity applied?

Just to be clear, I’m really looking to include information about collisions along the way in the prediction. As stated below, just following the parabola formed during the jump will get me the landing location, as long as nothing collides with the jumper along the way. That’s not terribly useful in the game, however, since there might be other platforms or objects that cause a collision.

Is there a way to cause a physics sweep to follow the path of the jump?

#3D Parabola = Paraboloid

4707-330px-paraboloid_of_revolution.svg.png

You can find the equation of a 3D parabola that matches how your character jumps in relation to your chosen gravity for your game, based on the character’s velocity at the time of jumping.

Then you can use this 3D equation to predict future jumps

This assume your character has very little Air Control of course :slight_smile:

:slight_smile:

Rama

You can get a simple approximation (assuming flat ground) as follows:

  • Calculate 2*Z/g, where (X, Y, Z) is the jump velocity and g is the UE4 variable “Gravity Z”. Call the answer k.
  • The landing position is the original position plus (Xk, Yk, 0).

Taking into account the landscape or objects the character can land on would involve intersection with a paraboloid (see Rama’s answer), but perhaps casting a ray upwards from the above approximation would be enough for your needs.

This doesn’t take collisions into account, so wouldn’t really be suitable for my needs.

I think you’ll need to split the parabola into a piecewise straight approximation: keep splitting it into half until the length of each section is less than a tolerance of your choosing.

@cuwaters Is this still a problem for you? I had to solve what I believe is a similar problem for my physics vehicle game. Let me know and if so I’ll post the algorithm I wrote to predict the landing location and adjust the jump accordingly. My implementation is for physics movement, but it can be adapted for kinematic bodies.

Here’s a short video of the solution in action: Planning Vehicle Landings in UE4 with Physics - YouTube

Yes, it’s still something I’d like to do. I’ve come up with some sub-standard workarounds, but your video looks much better than anything I’ve gotten working. I’d definitely appreciate knowing more about how you accomplished it.