Advertisement Jump to content
Sign in to follow this  

Target prediction for nonlinear motion

This topic is 3126 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts


I'm trying to solve the following problem, and I've run up against a gigantic wall.

You are given:
- Position and orientation of Objects A and B
- Speed of Object A
- Speed of a projectile
- The Yaw, Pitch, and Roll of Object A (note: this is not the instantaneous orientation, these values describe the motion of Object A, so every frame, you apply the Yaw Pitch and Roll to Object A and move it forward by its speed)

The question is: where do you aim so that a projectile fired from Object B will hit Object A?

If the motion is linear, I found this solution thanks to alvaro, which works great, but completely falls apart as soon as the motion is nonlinear.

Any ideas?


Share this post

Link to post
Share on other sites
An object with a constant angular velocity traces out a circle. You can use the parametric equation of a circle instead of the parametric equation of a line, and do things pretty much the same from there.

Share this post

Link to post
Share on other sites
I think Sneftel is correct.

You are trying to find the time at which the projectile will hit the target, which means solving this equation:

how_long_it_will_take_bullet_to_reach(future_position_of_target_at_time(t)) - t = 0

At t=0 the expression on the left is positive and, if the bullet is faster than the target, the expression will eventually become negative. You can use binary search or Newton-Raphson to find a solution of the equation numerically.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!