Finding the distance from a parabola (ballistic trajectory) to a point (for use in collision detection)

414 Views Asked by At

I need to have some form of collision detection / prevention for an object moving along a ballistic trajectory and a second stationary object on the same plane plane. The ballistic trajectory is specified by an origin, a launch speed and an orientation. The second object is just coordinates.

I know what I need to do (in theory). Find the equation of the ballistic trajectory, find the derivative, then take the inverse negative to get the incline for the normal on the parabola. Then construct a line through the stationary object with the incline I just found, then find the intersection of the line and the parabola, and finally calculate the distance between the intersection and the stationary point (and then compare the found distance to the sum of the radii of the objects).

That's all well said, but I've been trying for hours and I keep running into a wall. The furthest I got was getting the incline for the normal on the parabola (which I'm pretty sure is wrong):

     -g(v*cosθ)^2,     with g = gravitational constant, 
                            v = lauch velocity and θ = launch orientation

Please help, I need to make progress on this project and this has me stumped!

I'm very sorry if there is a similar question already answered; the only examples I could find were those with very simple parabola (those I can work with) or just explanations about ballistic trajectories. It's because the parabola is the result of a ballistic trajectory that the equation for it is so complex, and I couldn't find a similar example.