I plan to make a missile track and opponent and collide wi the opponent. I need to know a good intersection point when given my missile and opponent speeds and direction. This is mainly a physics problem. I know I have to try and set up a few equations based on the equation of distance = rate * time, then solve time and extrapoloate position from t. I saw this post in another forum: intersection I am still a bit confused. Can somebody explain this to me, rather than jumping to a result?
(comments are locked)

I like to split these problems out into two components. Figure out how long it will take your missile to reach your target, then use that time to predict where your target will be. To figure out the first part, you'll want to figure out how far your target is from the missle currently and how fast your target is moving away from the missile. This means trimming the target's velocity so that all that remains is how fast he is moving along the line between where he is and where the missile is. You then use this relative velocity to determine how long it will take for the missile to catch up to the target. Once you have that time, you use it to predict where your target will be in that time, and then aim the missile for that destination.
Note I didn't test any of this code, it's just from the top of my head from having to do this several times. Also, this won't give you the calculusperfect interception time and location, but it's pretty close and can be refined by running another iteration of it on the newlypredicted intercept location. This is what I did previously. I tried to take into account the new position and how the distance may have grown wii it iteration. The problem with your sample is that I could think I can hit my target and with the increase in distance from determining where my target is 't' amount of time along its path, and not actually hit it still. Is there a constant way to incorporate this increase in distance when extrapolating the new target position for an extra amount of time?
Apr 04, 2013 at 03:30 PM
1337GameDev
Any other ideas?
Apr 05, 2013 at 02:44 PM
1337GameDev
(comments are locked)

Maybe I don't fully understand the problem. But, if the missile is constantly tracking the target, you can simply pass the target's transform to the missile continuously in Update() and have the missile continuously update the vector it is moving along. (This vector is given in the first line of the example script in the previous comment). This will make the missile behave more like an heatseeking missile than a ballistic missile. But I am assuming that is what you want ?
(comments are locked)
