public bool Drive(RemoteTech.FlightComputer.Commands.DriveCommand dc, FlightCtrlState fs) { if (dc != null) { if (mVessel.srf_velocity.magnitude > 0.5) { float degForward = Mathf.Abs(RTUtil.ClampDegrees90(Vector3.Angle(mVessel.srf_velocity, mVessel.ReferenceTransform.forward))); float degUp = Mathf.Abs(RTUtil.ClampDegrees90(Vector3.Angle(mVessel.srf_velocity, mVessel.ReferenceTransform.up))); float degRight = Mathf.Abs(RTUtil.ClampDegrees90(Vector3.Angle(mVessel.srf_velocity, mVessel.ReferenceTransform.right))); if (degForward < degUp && degForward < degRight) { ForwardAxis = Vector3.forward; } else if (degRight < degUp && degRight < degForward) { ForwardAxis = Vector3.right; } else { ForwardAxis = Vector3.up; } } switch (dc.mode) { case RemoteTech.FlightComputer.Commands.DriveCommand.DriveMode.Turn: return(Turn(dc, fs)); case RemoteTech.FlightComputer.Commands.DriveCommand.DriveMode.Distance: return(Distance(dc, fs)); case RemoteTech.FlightComputer.Commands.DriveCommand.DriveMode.DistanceHeading: return(DistanceHeading(dc, fs)); case RemoteTech.FlightComputer.Commands.DriveCommand.DriveMode.Coord: return(Coord(dc, fs)); } return(true); } return(true); }