So in our current campaign server, we are bringing AI aircraft and they are supposed to match speed with/fly along with breather pilots.
So it's all been going well except I noticed that at high altitudes the aircraft that by ALL INDICATIONS were set to go the same speed as the player's aircraft, were in fact going much, much faster.
So you can guess the cause of the problem I figured out: When you get an aircraft's current velocity via actor.Vwld() (and thing use the distance formula to convert that into current sped) that is of course, true airspeed. How fast they are moving through space, according to Clod.
BUT . . . when you set an airwaypoint for an AI aircraft to follow in-game--or as part of a .mis file--the airspeed you enter there is, apparently and sensibly, indicated airspeed.
So . . . do we know the exact formula CloD is using to convert from true air speed back to the indicated airspeed as shown on the aircraft's dials?
Or, is there some reliable way to read off the current indicated airspeed for each aircraft, so we can go based on that? When I say "reliable" I mean, something that will work for EVERY aircraft in game, not some hinky thing were you'll have to treat spitfires different from 109s different JU88s different from Beaufighters etc.
Any thoughts?
I tried using parameters like this, but none seemed to give me what I really needed. Like the .Z_VelocityTAS and .Z_VelocityIAS values were both the same, when I would expect them to differ by maybe 30% at 6000m altitude.
Code:
if (targetAircraft != null) tas = (double)targetAircraft.getParameter(part.ParameterTypes.Z_VelocityTAS, -1);
if (targetAircraft != null) ias = (double)targetAircraft.getParameter(part.ParameterTypes.Z_VelocityIAS, -1);
if (targetAircraft != null) mach = (double)targetAircraft.getParameter(part.ParameterTypes.Z_VelocityMach, -1);
I also tried I_VelocityIAS similarly to above and I don't think I received anything at all there.
Any thoughts or ideas?
Can we just use standard TAS/IAS conversion formulas (which . . . sounds super complicated)? Or is there a TAS/IAS converter built into the CLoD code somewhere?
FWIW I'm using a very simple TAS->IAS approximation formula for now, something like add X% for every 1000m meter altitude gained. It sort of works but it's not the best.
Bookmarks