Bug fixes and tuning.

This commit is contained in:
Anna Rose 2021-08-12 01:36:58 -04:00
parent ae235821b0
commit 0481123487

View File

@ -44,22 +44,23 @@ function Hover {
} }
function alignForHover { function alignForHover {
set cRot to SHIP:FACING:FOREVECTOR.
if ReadSensor("PRES") = 0 { if ReadSensor("PRES") = 0 {
// if we're in a vacuum, align with retrograde for smoother horizontal control. // 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.". 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 { if done {
restoreControls(). restoreControl().
return. return.
} }
} else { } else {
// ... otherwise just align vertically. // ... 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.". print "Aligning vertical.".
wait until done or VAng(SHIP:FACING:FOREVECTOR, SHIP:UP:FOREVECTOR) < 1. wait until done or VAng(SHIP:FACING:FOREVECTOR, SHIP:UP:FOREVECTOR) < 1.
if done { if done {
restoreControls(). restoreControl().
return. return.
} }
} }