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. } }