# Calculate Jump Limits

My question is in a similar vein to this question, I am creating a pre-mapped pathfinding solution much akin to how Ash Blue was for my 2D platformer-style game (in XNA). As part of the process, I have to be able to 'neighbor' nodes in the pathfinding algorithm. To be able to do this, I need a procedural manner to precalculate the maximum capabilities of motion from a given game object at a given location. I am having a difficult time with one specific aspect of this: I cannot, for the life of me, figure out how to test whether or not a game object will be able to successfully jump to a given platform from where they are standing. I know there's a way to express this in some manner of equation, but I cannot find what the proper equation would be, it's probably in the vein of projectile physics, but the answer eludes me. If anybody can shed some insight into the matter, I would be very grateful.

• Do you mean that you are firing your objects at some maximum velocity and you want to know the maximum range they can go? If so I can write up an answer Commented Dec 18, 2015 at 8:26

I tried to tackle this myself but got stuck, fortunately math.stackexchange came to the rescue with this question.

Summary

Given a particle which starts at position (0,0) and is fired at velocity v_max the maximum range it can achieve is,

x_max = Sqrt(v_max^4 / g^2 - 2 * v_max^2 * y_fin / g)


where g is the acceleration due to gravity (for earth g ~ 9.81) and y_fin is the final height of the particle (e.g. the height of the platform it needs to reach. This maximum range is achieved when the particle is fired at an angle,

theta = Atan( (1 - 2 * y_fin * g / v_max^2)^(-1/2) )
= Atan( Sqrt(1 / ((1 - 2 * y_fin * g / v_max^2)) ),


where Atan is the inverse tan function.

Note

If desired I can explain in more detail how to achieve this result (as after seeing the approach in the linked question I was able to solve it myself) it requires knowledge of differentiation and trigonometric identities but is not too difficult.

• I don't think I understand, if y_fin is the desired final height of the particle, wouldn't that potentially result in an x_max that is higher than the particle is capable of achieving? Or is that essentially how you test if the particle is capable of reaching the target? Commented Dec 20, 2015 at 21:55
• Because platforms can be lower than where the particle starts the particle can go further than if the platform is at the same height. So if y_fin is very large and negative then the particle will go further. Of however all platforms are at the same height then it simplifies. I can post an update including that tomorrow. Commented Dec 21, 2015 at 0:41