- Home /
Suborbital Missile Pathing
I am making a game where you can launch nuclear missiles from various countries around the world. I am struggling to get the missile pathing to be realistic. What I want the missiles to do, more or less, is launch up (away from the center of the earth) and gradually turn until it is in a suborbital path around the earth. When the missile is close to its target, it should essentially do the opposite of its launch movement and fly down into the target. An example of this missile movement can be found in MAD: Global Thermonuclear Warfare.
I've tried a few things to fix it, namely bezier curves. The curves work nicely unless I'm launching from, for example, the north pole to antarctica. If I launch too far of a distance, it shoots the missile through the earth; otherwise it looks great. I've also been pondering if I could devise a way to rotate the missile towards the target (AI vs pathing.)
Does anyone have any insight as to how I'd go about doing this? If I can't fix it, I'll have to use bezier curves and make it so you can't launch from/to antarctica...
Answer by _MGB_ · Feb 19, 2012 at 10:31 PM
You could maybe use two bezier curves to prevent paths through the earth? Use a midpoint between the launch & target positions (projected outwards to the desired altitude).
I should have mentioned that I've tried that already. I actually used three curves with 3 points each (7 points total, two shared.) While it has the possibility of working, I can't for the life of me figure out the math to get each point just right to make it look realistic. The main struggle I'm having with getting those 7 points right are that I am forced to use Vector3 directions vs rotations and it's confusing rotating/putting them how I want. The kind of answers I'm looking for are more in the code/example department, than the idea department.
Answer by Destroyd · Feb 20, 2012 at 06:52 AM
Well... I fixed it myself. This seems to happen a lot. I'll ask for help and continue working on the problem myself, and usually fix it before someone else has a better idea. Basically what I did is link 3 bezier curves together. The first one with 4 points, the middle one with 3, and the end one with 4. Each curve is linked at one point for a total of 9 different points.
The math for it was a whole lot simpler than I realized. I just started with the beginning, middle, and end points which I derived from knowing the missile's launch/destination points. Then I basically put the other four points between those, normalized them, and made their distance fixed from the earth's center (resulting in a faux suborbital position.)
If anyone wants to see the code for it, I'll be glad to share.
Your answer
![](https://koobas.hobune.stream/wayback/20220613064238im_/https://answers.unity.com/themes/thub/images/avi.jpg)