I've got a solution for this that works with firefly fine but the way you've implemented it is different because your axis are all different so its thrown me off a bit.
There's a way to calculate all 3 axis using a single Atan2 which would be preferable to the current implementation of tracking it separately.
Whilst I was happy with Firefly and how it worked there, the issue was collision detection. Meanwhile I try to do the same thing in P3D and I have the collisions working great but the gimbles don't line up at all because something is flipping the UP axis which in turn inverts the other 2 axis which is not ideal.
I'll do a public service for everyone. To get tracking working on 3 axis using Atan2 all you need to do is the following:
--- Items below are attributes for the "AIPlayer" object ---
//Where AI is to where AI is shooting at
DistanceX = PosXAIPlayer - PosXTarget
DistanceY = PosYAIPlayer - PosYTarget
DistanceZ = PosZAIPlayer - PosZTarget
//Rotates the AI gun to where it needs to shoot - projectiles are then fired using that heading
RotX= 0 - ATan2(DistanceY( "AIPlayer" ), Sqr(( DistanceX( "AIPlayer" ) * DistanceX( "AIPlayer" ) ) + ( DistanceZ( "AIPlayer" ) * DistanceZ( "AIPlayer" ) )))
RotY only needs to track in X and Y. As such an Atan2 should cover it.
This code works in Firefly.
This is so that when the object moves past the 0 point and into negative its calculated correctly so that the value does invert correctly because it also takes into account height as well. This is how in Fusion you can track an object in 3D space with all 3 vectors simulated. This gets you a heading, apply speed value to it and the projectile moves along the RotX and RotY (I'm not tracking the Tumble because there's no point). I hope you can do something with this because this took me about a month to develop in firefly due to having to figure out how to track it for player and AI (which is different for both. But you already have the player one working so I don't need to share that).
Reason I'm doing this is because I'd like to salvage the work I did over a year ago for firefly and port it into P3D. I really like your collision implementation better its much faster and your lighting engine is better because there's no hard limits.
Hope this helps anyway. And for the firefly users feel free to use that code.