From 3376a6f35d4c632a765a89569f5aebcc62276bdd Mon Sep 17 00:00:00 2001 From: PlayeRom Date: Sun, 21 Aug 2022 21:35:15 +0200 Subject: [PATCH] Use towrope length for initial distance of AI plane --- nasal/flight-plan.nas | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/nasal/flight-plan.nas b/nasal/flight-plan.nas index 01530b6..2ca0ae2 100644 --- a/nasal/flight-plan.nas +++ b/nasal/flight-plan.nas @@ -224,7 +224,7 @@ var FlightPlan = { var gliderOffsetM = me.getGliderOffsetFromRunwayThreshold(location); # ... and line up with the runway - me.addWptGround({"hdgChange": 0, "dist": 30 + gliderOffsetM}, {"altChange": 0, "ktas": 2.5}); + me.addWptGround({"hdgChange": 0, "dist": me.getInitialDistance() + gliderOffsetM}, {"altChange": 0, "ktas": 2.5}); # Rolling me.addWptGround({"hdgChange": 0, "dist": 10}, {"altChange": 0, "ktas": 5}); @@ -271,6 +271,17 @@ var FlightPlan = { return 1; }, + # + # Get initial distance AI plane from the glider that the tow is nearly tautened. + # + # Return distance in meters. + # + getInitialDistance: func () { + var ropeLengthM = getprop("/sim/hitches/aerotow/tow/length") or 60; + var tautenRelative = 0.68; + return ropeLengthM * tautenRelative; + }, + # # Initialize AI aircraft variable # @@ -307,7 +318,7 @@ var FlightPlan = { return rwyThreshold.distance_to(gliderCoord); } - # We are not on runway + # We are not on the runway return 0; },