Cheapest way to test collision along a parabolic arc

I have created a parabolic arc function to predict air time for a character when he jumps at different speeds off objects in the world, and I want to predicts how far he will travel before he hits the ground.

It might be several seconds in the air before he hits the ground, and to exactly follow the parabolic arc with raycasts would be hundreds of ray cast. Anyone have any suggestions for a cheaper way of achieving this?

If all objects consist of sloping segments and such, just use the typical line-quadratic curve in 2D intersection tests to determine collision time of trajectory projectile against any relevant “slopes” whose curving arc cuts through them.

A flash fiddle in 2D. Includes a description of a “possible” way to extend it to a 3D context.

Note that for “fully vertical surfaces” (ie. infinite ‘m’ in y=mx+b line equations), you just need to get the 2D bird’s eye colision time of the ray intersection against the wall segment to know the “time-of-impact” in 2D, and the trajectory’s y height position at that intersection point will identify where/(and whether) it hits within the surface at that given time of impact. No quadratic formula needed.

Some high school math links for reference:

There are two ways I can think of:

1: Use raycasts! They are really, really cheap. You’ll want to approximate your parabola with not that many raycasts - 5 or so should be enough. Doing a couple of raycasts every frame is actually not as bad as you’d think it is.

2: Use a particle system! Make particles that follow your parabola, and turn on particle collisions. You can grab the intersection point where the particles hit the ground with a script attached to the particle system (or the ground), and base your maths on that. Check our raycast collisions here and here.

2 will give you a more accurate result than 1 if you can get the particles to follow your parabola. I have no idea which one is best performance wise, but remember that the physics system is pretty fast, so you should be fine in either case.