public Tuple4 Rotation(ReferenceFrame referenceFrame) { var up = Vector3.up; var right = InternalBody.GetRelSurfacePosition(0, 0, 1).normalized; var forward = Vector3.Cross(right, up); Vector3.OrthoNormalize(ref forward, ref up); var rotation = Quaternion.LookRotation(forward, up); return(referenceFrame.RotationFromWorldSpace(rotation).ToTuple()); }
public Tuple4 Rotation (ReferenceFrame referenceFrame) { if (ReferenceEquals (referenceFrame, null)) throw new ArgumentNullException (nameof (referenceFrame)); var up = Vector3.up; var right = InternalBody.GetRelSurfacePosition (0, 0, 1).normalized; var forward = Vector3.Cross (right, up); Vector3.OrthoNormalize (ref forward, ref up); var rotation = Quaternion.LookRotation (forward, up); return referenceFrame.RotationFromWorldSpace (rotation).ToTuple (); }