Download

Getting the location of where a projectile will land (before it lands there) ?

I am trying to get an a.i. to catch a ball before it bounces. Getting the character to chase down the ball after it has bounced around is pretty easy (close the gap between character and ball in some form or another). But im having trouble getting character to smoothly run towards where the ball is headed and catch it like a receiver catching a pass thats been passed to him. If I could get the ai to run towards where the projectile is expected to land that should work but the projectile is launched from a different location with different height and force with each launch. Does anybody have any ideas as to how this could be done? Any math trick I am over looking or physics oriented line trace that gets the determined trajectory prior to the completion of the trajectory?

Thanks

There is a node called SuggestProjectileVelocity. It kind-of does the opposite of what you want, but you might be able to use it to your advantage.

It inputs a start location, end location, and launch speed. Outputs a velocity. This may make your problem easier; instead of launching a ball first then calculating its trajectory, calculate the End Location first then suggest a trajectory.

For getting the End Location, I recommend tracing like this grenade trajectory blueprint: How to create Grenade arc using Blueprint? - UE4 AnswerHub - You just put in your use your force where it calls for “Grenade Launch Velocity”, and your height as an up/forward rotation vector.

Once the trace completes, use the hit location as the “End Location”, then simultaneously SuggestLaunchVelocity to launch the ball and have your AI run there.

Edit: Now that I’ve posted this, you could honestly just probably skip the “SuggestProjectileVelocity” part, and store the traced location for the AI.

That grenade trajectory looks like it is in the ball park of what I am after many thanks!