TEMPEST.114 Posted February 9, 2023 Posted February 9, 2023 I'm trying to change the speed by 20kts Here's the maths of what's happening in the script 2023-02-09 16:54:31.579 INFO (Main): magnitdue 208.744693 2023-02-09 16:54:31.579 INFO (Main): knots 405.767222 2023-02-09 16:54:31.579 INFO (Main): newSpeed 425.767222 deltaSpeed 20.000000 2023-02-09 16:54:31.579 INFO (Main): newSpeedInMPS 219.033582 (magnitude is the MPS of the aircraft before any changes) i.e. getVelocity() I convert to knots, make the delta change and reconvert back to MPS before I issue the setSpeed command. These numbers were used on an F18 at 18000ft at 350kts. After the change, it's speed went to 425kts. What the hell is going on? Is this a bug? Here's the code: local velocityInMPS = selectedAircraft.unit:getVelocity() local magnitude = GetVectorMagnitude(velocityInMPS) local knots = MpsToKnots(magnitude) local newSpeed = knots + deltaSpeed local newSpeedInMPS = KnotsToMPS(newSpeed) selectedAircraft.group:getController():setSpeed(newSpeedInMPS, true)
TEMPEST.114 Posted February 9, 2023 Author Posted February 9, 2023 This is frustrating... local velocityInMPS = GetVectorMagnitude(magnitude) local knots = MpsToKnots(velocityInMPS) where function MpsToKnots(mps) return mps * 1.94384449 end function GetVectorMagnitude(vec) return (vec.x^2 + vec.y^2 + vec.z^2)^0.5 end For this: Google says: But the function returns 363kts What's going on?!
Recommended Posts