Jump to content
  • Advertisement
Sign in to follow this  
Adiss

Target prediction for nonlinear motion

This topic is 3028 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

Hi,

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?

Thanks!

Share this post


Link to post
Share on other sites
Advertisement
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 GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!