Skip to content

Commit

Permalink
Fix misbehaviour of Packed Spin
Browse files Browse the repository at this point in the history
  • Loading branch information
markusa380 committed May 19, 2017
1 parent 38cff27 commit 4388c31
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Binary file modified GameData/PersistentRotation/Plugins/PersistentRotation.dll
Binary file not shown.
6 changes: 5 additions & 1 deletion Source/Main.cs
Expand Up @@ -309,7 +309,11 @@ private void OnVesselGoOffRails(Vessel vessel)
/* PRIVATE METHODS */
private void PackedSpin(Data.PRVessel v)
{
Vector3 _angularVelocity = v.storedAngularMomentum / (Vector3.Dot(v.vessel.MOI, v.storedAngularMomentum));
Vector3 _angularVelocity = Vector3.zero;

_angularVelocity.x = v.storedAngularMomentum.x / v.vessel.MOI.x;
_angularVelocity.y = v.storedAngularMomentum.y / v.vessel.MOI.y;
_angularVelocity.z = v.storedAngularMomentum.z / v.vessel.MOI.z;

if (v.vessel.situation != Vessel.Situations.LANDED && v.vessel.situation != Vessel.Situations.SPLASHED && v.vessel.situation != Vessel.Situations.PRELAUNCH)
v.vessel.SetRotation(Quaternion.AngleAxis(_angularVelocity.magnitude * TimeWarp.CurrentRate, v.vessel.ReferenceTransform.rotation * _angularVelocity) * v.vessel.transform.rotation, true);
Expand Down

0 comments on commit 4388c31

Please sign in to comment.