UPDATE (27 JUL 2025)
I finally figured out the math for a circle pursuit - where the enemy is on your tail and is trying to stay there while you turn. Here is the latest program, which combines the old Intercept routine (where the target is basically flying straight) with a new circle override (where the target is turning). I still need to make this handle vertical loops and all the various other aspects of air combat, such as the initial engagement.
very cool. of course since you mentioned vertical loops, the second thing I tried (after circle engagement) was a vertical loop, and I see the gimbal locking issue. Wondering if youâre using quaternions to compute these rotations? Imo it simplifies a lot of the math you have to do vs using Eulers, and gets around the gimbal locking problems.. allows better interpolation etcâŚ
I use a âpitch planeâ method to compute pitch values which eliminates gimbal lock problems.. (See this example) I compute pitch changes along the pitch plane and then convert the results to the vertical plane, taking into account pitch plane pitch and pitch plane bank. Fortunately, three.js makes this easy.
If you try to compute the impact of pitch changes directly on the vertical plane, you run into the problem that, at the top of the loop, the same change in aircraft pitch (relative to the pilot), has an increasingly smaller impact on pitch angle, eventually becoming immeasurably small.
great visualization.. thank you
I have completed the animation sequence for the plane handler.
When you start, he is just finishing the signal for âremove chocksâ (arms waving) and proceeding to the signal for âbrakes onâ (two arms up). (You donât have to do anything here since you are locked to the carrier.) Then he transitions to one hand in the air, waiting for you to start your run-up (the throttle is disabled before then). If you increase the throttle, he will start the ârun upâ signal (hand rotating) for a few seconds - giving you time to increase to full throttle. He will then proceed to the âtake-offâ animation and your plane will be unlocked from the carrier.
This sequence allows you to choose when to start your run-up, but does not allow you to take-off until the full animation sequence is complete. Of course, you can screw up by trying to take off at less than full throttle - but that one is on you.