# 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.

## 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?

*edit2*
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.

*edit*
Corrected P(A)

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

##### 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 on other sites
Do you see this being used only in a game, or are you also interested in real-life effects like sensor noise?

1. 1
2. 2
3. 3
4. 4
Rutin
14
5. 5

• 10
• 11
• 14
• 10
• 25
• ### Forum Statistics

• Total Topics
632652
• Total Posts
3007659
• ### Who's Online (See full list)

There are no registered users currently online

×