# Predictive Collision Detection - Find Time Of Impact I have a green box at a starting position A. It can move along two paths

• A to B is linear motion
• A to C is under the influence of gravity (non-linear)

The thin vertical line is a fixed colliding wall. All objects are represented with axis-aligned AABB bounding boxes.

For the path A to B, if my understanding is correct, I (think I) can determine the time of impact (T0) on the wall based on swept-AABB collision techniques. this case simply reduces to motion along x-axis, and time of impact can be calculated easily.

My question is for path A to C. Under the influence of gravity how can I determine the time of impact (T1) relative to the starting time T at location A. (The motion of A to C can be predicted using the standard equations of motion)

Are there any techniques/algorithms available for this?

EDIT To clarify the vertical wall is illustrative - walls can be arbitrarily vertical or horizontal or both (like a corner). They will be stationary, and axis aligned though. Assuming A at position 0,0

free fall equations (with starting velocity on x (Vx) , and g=gravity constant ) are:

(1) x=Vx * t

(2) y= (1/2)*g * t^2

substitute t in second eq. you get

(3) y= (1/2) * g * (x/Vx)^2

where g and Vx are known.

This is a parabola equation : Intersect (3) with each wall segment to get the eventualy collisions point cX,cY

If there are solutions For each collision points sobstitute (1) with cX to get time T. Choose the minimum T.