# How to determine where an object will land on a variable elevation surface?

I'm making a game and I need to figure out the exact point on a hilly surface where the car will land after the jump.

Here is an image:

So since this is a game, it's very easy for me to figure out the start position, velocity angle and speed of the car. However, I'm not sure how to calculate many points along the curved line the car will follow as it falls to the ground. All the examples I've been able to find either assume the ground is flat, or assume I know what the final elevation will be.

Basically, what I have been unable to find is a formula where I can put in a X distance and figure out what the Y is on that curve. If anyone could point me in the right direction, that would be incredibly helpful.

You're given $$v$$, $$\theta$$, $$x_0$$, and $$x_y$$ and you want to calculate $$y$$ in terms of $$x$$. Then you can use that to plug into the equation for the surface and solve.

Firstly, resolve $$v$$ into $$v_x = v\cos(\theta)$$ and $$v_y = v\sin(\theta)$$.

Then $$x = v_xt$$ and $$y = v_yt+\frac{1}{2}gt^2$$ (assuming you have a constant gravitational field which isn't really a given I suppose!)

Then eliminate $$t$$ to give:

$$$$y = \frac{v_y}{v_x}x + \frac{gx^2}{2v_x^2}$$$$

Of course, $$\frac{v_y}{v_x} = tan(\theta)$$, so you can put that in if you like. If you have a different $$g$$ you'd have to do the integration to figure out the equation for $$y$$. And if $$g$$ had an $$x$$ component you'd need to integrate it into the equation for $$x$$.

Anyway, you'll notice that we have a parabola. And since $$g$$ is negative, it's a frowny parabola which is what we would expect.

Now it depends on what your elevation is. If you have a nice equation for that surface you can solve them simultaneously. Depending on details, you may have more than one solution (for example, if your path goes through a hill, there might be two solutions: one for each side). Normally, the first solution would be what you're looking for, so the one with the highest $$x$$ (or lowest depending on your axes and direction of movement, but assuming normal conventions and the picture you showed, it would be highest).

• Thanks, this mathematically worked. Apr 16, 2020 at 3:28
• You're most welcome. Does the "mathematically" mean that it didn't work in some other way? Apr 16, 2020 at 3:38
• The game engine (Unity) seems to not be 100% accurate in its calculation of the car physics from the start point (I suspect the wheel suspension) so I have to update the calculation as the car is in the air, otherwise it'll be off, usually by just a bit. Here is a visualized video: youtu.be/VjywiW3dGzQ The rotation bug is my coding, but for my purposes I don't anticipate major issues with the updating in the air approach since all I'm using it for is to interpolate the car's start rotation to whatever angle is necessary to land on the end point with all 4 wheels on the ground at once. Apr 16, 2020 at 3:43
• The calculation is presumably the centre of gravity which will never hit the road anyway. So maybe that's the offset that's needed? Otherwise, you'd probably be better off with a numerical calculation of each step rather than an analytical solution. Apr 16, 2020 at 6:28
• Could you tell me what you meant by numerical calculation of each step? I did check the centre of gravity but it's about 0.1 units off of some of the axis... the resulting line is virtually identical. Apr 16, 2020 at 23:24