Jump to content
  • Advertisement
Sign in to follow this  

Movement prediction

This topic is 2916 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 currently writing code that controls a rocket in order to hit a (possibly) moving/accelerating target. I'm aiming for a newtonian solution: the rocket applies forces in whatever direction possible & necessary in order to fly to the target. This works fine for a stationary target but fails when the target is moving: It can't yet predict where the target would be and thus won't directly hit the target when flying perpendicular to it. Instead it would fly behind the target and hit it then.

I've tried to come up with a solution that doesn't involve some step-by-step simulation because that would probably be overkill for a game. Instead I reduced the problem from 3 dimensions to 1.

I simply assume both A and B are flying in the same direction.
Since I know distance, velocity and acceleration of both, I can solve the following equation for t and then calculate the probable position of A in 3 dimensional space again.

What do you think of this solution? Do you have an alternative approach that might give better (more accurate) results?

I have found out that projection the target's velocity onto the dotted line seems to result in a better overall accuracy. I think I'll keep this one until I found a better solution.

Corrected P(A)
Fixed Picture link

[Edited by - SiS-Shadowman on September 28, 2010 3:51:43 PM]

Share this post

Link to post
Share on other sites
Have you looked into PID (Proportional Integral Derivative) methods? I recently read in AI Game Programming Wisdom 2 about PID controllers, and the example the author uses is of a missile trying to hit a target.

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!