Hi, I've been playing with lead collision course (called proportional navigation in missiles) and I recently came across a simple solution with trigonometry that I wanted to share.
Lead collision course is well known by sailors to avoid collision with other ships. The rule is quite simple, if your ship gets closer to another ship, and if the other ship stays at the exact same angle, you are on a collision course.
This is also used to guide modern missiles (in fact modern missiles are a lot more complex). It makes a missile far more effective than pure pursuit (simply following the target). Impact probality is improved on maneuvering targets, fuel consumption is optimised (increasing the missile range), and viewed from the target, the missile stays at the same angles, making it hard to spot.
I explain the trigonometry procedure I came across in an image :
 Click here for full size image
Here is the code in two functions for 3d (for 2d just consider z=0) :
Just call LeadCollision with proper parameters and get your lead collision vector in leadCol_vx#,leadCol_vy#,leadCol_vz# variables. You can also find the impact point (approximative). It can be useful for a missile for example, to see if the impact point is not in the ground...
And finally, here is an example in use with Blitz3D, comparing proportional navigation with pure pursuit : Download archive Both missiles are exactly the same physically (turn rate, cone angle, speed, acceleration...), just the guidance is different, and you'll see the difference of effectiveness. Sorry for the explosions, they are not optimised (simple bunch of sprites), so it can drop fps...
Hope it can help, I didn't find this kind of stuff in the code archive.
|