/// <summary> /// Compute current angular velocity in pitch,roll,yaw axes /// </summary> Vector3 ComputeCurrentAngularVelocity() { var worldAngularVelocity = vessel.InternalVessel.GetComponent <Rigidbody> ().angularVelocity; var localAngularVelocity = ReferenceFrame.AngularVelocityFromWorldSpace(worldAngularVelocity); //TODO: why does this need to be negative? return(-vessel.ReferenceFrame.DirectionFromWorldSpace(ReferenceFrame.DirectionToWorldSpace(localAngularVelocity))); }
/// <summary> /// Compute current angular velocity in pitch,roll,yaw axes /// </summary> Vector3 ComputeCurrentAngularVelocity() { var worldAngularVelocity = vessel.InternalVessel.GetComponent <Rigidbody> ().angularVelocity; var localAngularVelocity = ReferenceFrame.AngularVelocityFromWorldSpace(worldAngularVelocity); // TODO: why does this need to be negative? var ret = -vessel.ReferenceFrame.DirectionFromWorldSpace(ReferenceFrame.DirectionToWorldSpace(localAngularVelocity)); if (PlaneMode) { var tav = TurnAngularVelocity(); if (vessel.InternalVessel.GetSrfVelocity().magnitude < 1200) { var up = new Vector3d(1, 0, 0); up = vessel.ReferenceFrame.Rotation.Inverse() * vessel.SurfaceReferenceFrame.Rotation * up; tav = Vector3d.Dot(up, tav) * up; } ret = ret - tav; } ret = transitionMat.MultiplyVector(ret); return(ret); }