The Phalanx turret is animated, it is just too far to be seen. My current solution is a Nasal script implementing a class, I can easily spawn as many instances of that class as necessary, initializing it with different property bindings. There is currently some Phalanx-specific stuff included but I'm planning to make AA guns and even a ZSU-23-4 "Shilka" with a somewhat modified version of this.
Still there is some more tuning to be done, but it already takes into account terrain blocking direct visibility (or Earth curvature at large ranges) etc. Once it is finished, I could provide it to you.
And I know onox have developed something similar, but with quite different approach. I use rather slow updates and extrapolation/interpolation for the aiming, calculating the movement in x,y,z coordinates as seen from the gun's position (to easily predict movement) and then back to bearing/elevation/distance. He uses rapid updates instead, probably simply calculating bearing and elevation to target, with some smart noise filters applied.
Not sure if he has the ballistic prediction already, but his direct aim on a static or moving target was a bit better than mine AFAIK. I'm a few meters off over 2nm distance, but for the target to be hit that is still more than enough considering the dispersion.
The ballistics are a matter of submodel parameters, I got mine by gathering in-sim experimental data :
With this code using short bursts:
- Code: Select all
var myPos = geo.Coord.new();
myPos.set_latlon(getprop("/position/latitude-deg"), getprop("/position/longitude-deg"), getprop("/position/ground-elev-m"));
var submImpactPos = geo.Coord.new();
submImpactPos.set_latlon(getprop("/ai/models/ballistic/impact/latitude-deg"), getprop("/ai/models/ballistic/impact/longitude-deg"), getprop("/ai/models/ballistic/impact/elevation-m"));
var dist = myPos.direct_distance_to(submImpactPos);
var time = getprop("/ai/models/ballistic/sim/time/elapsed-sec");
print(dist~" "~time);
setprop("/ai/models/ballistic/sim/time/elapsed-sec", 0);
But I guess it would be possible to get the exponential time dependance from the submodel parameters directly.