Download

Predicting impact of physics object

Anyone do any work where you predict based on current movement of a physics object an approximate path to determine where it’ll land. Or where it will be if it maintains that movement.

Basically looking if possible to create an ai that will attempt to avoid or catch a ball that is flying.

try this: 1/2at*t

If gravity is the only force acting on the object, you can determine the object’s movement pretty easily through integration.

Choose a small step time (dt), delta velocity will be gdt and delta position will be vdt, v being the new velocity. You can do this until the object intersects the ground.
Note that if the object is not a ball, you can also integrate rotation (C++ only, as quaternions are not available in Blueprints as far as I know) to better predict the impact point (it won’t have that much influence, though).

Nawrot’s suggestion is the analytical solution: for initial position and velocity x[SUB]0[/SUB] and v[SUB]0[/SUB], you have v(t) = at + v[SUB]0[/SUB] (here, a = g), and x(t) = 1/2 at[SUP]2[/SUP] + v[SUB]0[/SUB]*t + x[SUB]0[/SUB].