Skip to content

Commit

Permalink
Check for live rb and non-kinematic when restoring angular velocity
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanKell committed Nov 5, 2023
1 parent 807e5aa commit f5c4c0e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Source/VesselModuleRotationRO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,13 @@ private void FixedUpdate()

if (_restoreAngularVelocity) // Restoring saved rotation if it was above the threshold
{
// Debug.Log("[US] " + vessel.vesselName + " going OFF rails : restoring angular velocity, angvel=" + angularVelocity.magnitude);
ApplyAngularVelocity();
okToSaveAngularVelocity = false;
_restoreAngularVelocity = false;
if (vessel.rootPart.rb != null && !vessel.rootPart.rb.isKinematic)
{
// Debug.Log("[US] " + vessel.vesselName + " going OFF rails : restoring angular velocity, angvel=" + angularVelocity.magnitude);
ApplyAngularVelocity();
_restoreAngularVelocity = false;
}
}

// Saving angular velocity (if we can), SAS mode, and check target hold status
Expand Down

0 comments on commit f5c4c0e

Please sign in to comment.