From 0481123487c6dd0e62fd7610dee6ede17ffe7f7a Mon Sep 17 00:00:00 2001 From: annabunches Date: Thu, 12 Aug 2021 01:36:58 -0400 Subject: [PATCH] Bug fixes and tuning. --- lib/stabilize_rocket.ks | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/stabilize_rocket.ks b/lib/stabilize_rocket.ks index 8ad50d6..62953fd 100644 --- a/lib/stabilize_rocket.ks +++ b/lib/stabilize_rocket.ks @@ -44,22 +44,23 @@ function Hover { } function alignForHover { + set cRot to SHIP:FACING:FOREVECTOR. if ReadSensor("PRES") = 0 { // if we're in a vacuum, align with retrograde for smoother horizontal control. - lock STEERING to LookDirUp(SHIP:SRFRETROGRADE:FOREVECTOR, SHIP:FACING:TOPVECTOR).. + lock STEERING to LookDirUp(SHIP:SRFRETROGRADE:FOREVECTOR, cRot). print "Aligning with retrograde.". - wait until done or VAng(SHIP:FACING:FOREVECTOR, SHIP:SRFRETROGRADE:FOREVECTOR) < 0.1. + wait until done or VAng(SHIP:FACING:FOREVECTOR, SHIP:SRFRETROGRADE:FOREVECTOR) < 1. if done { - restoreControls(). + restoreControl(). return. } } else { // ... otherwise just align vertically. - lock STEERING to LookDirUp(SHIP:UP:FOREVECTOR, SHIP:FACING:TOPVECTOR).. + lock STEERING to LookDirUp(SHIP:UP:FOREVECTOR, cRot). print "Aligning vertical.". wait until done or VAng(SHIP:FACING:FOREVECTOR, SHIP:UP:FOREVECTOR) < 1. if done { - restoreControls(). + restoreControl(). return. } }