MW UNITY NAMESPACE








































[Serializable] public struct

MRotator


A Quaternion rotation implementation defined by Pitch, Yaw and Roll in degrees.



public float

Pitch

The rotation in degrees around the X axis. 0 = Forward, +Up, -Down.



public float

Yaw

The rotation in degrees around the Y axis. 0 = Straight, +Right, -Left.



public float

Roll

The rotation in degrees around the Z axis. 0 = Up is 12 o'clock, +Clockwise, -Counter-clockwise.



public static readonly MRotator

Neutral

An MRotator with no rotation.


kEpsilon

Rotator floating-point precision.


CONSTRUCTOR (float P, float Y, float R)

Summary:

Makes a rotation with Pitch, Yaw and Roll.

Params:

P:

        Pitch.

Y:

        Yaw.

R:

        Roll.


CONSTRUCTOR (MVector PYR)

Summary:

Makes a rotation with an MVector.

Params:

PYR:

        An MVector where X = Pitch, Y = Yaw, and Z = Roll.


CONSTRUCTOR (Quaternion Quaternion)

Summary:

Makes an MRotator with a Quaternion.

Params:

Quaternion:

        The Quaternion defining the Pitch, Yaw, and Roll.



public Quaternion

Quaternion ()

Summary:

Computes a Quaternion with a rotation of Pitch, Yaw and Roll.

Returns:

A Quaternion with Pitch, Yaw, Roll.



public Quaternion

Quaternion (Transform T)

Summary:

Computes a Quaternion with a rotation of Pitch, Yaw and Roll.

Params:

T:

        The Transform to combine with.

Returns:

A Quaternion combining T's Rotation with this Pitch, Yaw, and Roll.



public MRotator

Rotation (Transform T)

Summary:

Computes a Rotator combining T's Rotation with Pitch, Yaw, and Roll.

Params:

T:

        The Transform to combine with.

Returns:

An MRotator combining T's Rotation with this Pitch, Yaw, and Roll.



public MRotator

Relative (MVector Vector, MVector UpVector)

Summary:

Computes a Rotator relative to a directional Vector and Up Vector.

Remarks:

Suppose UpVector is the Positive Y-Axis.

Params:

Vector:

        Relative facing direction.

UpVector:

        Global Up Vector.

Returns:

An MRotator rotated relative to a Vector with respect to Up.



public static MRotator

Rotator (Quaternion Q)

Summary:

Converts a Quaternion to an MRotator.

Params:

Q:

        The Quaternion to extract Pitch, Yaw and Roll.

Returns:

An MRotator rotated according to a Quaternion.



public static MRotator

LookRotation (MVector Direction, MVector Up)

Summary:

Gets the rotation required to look towards a direction with an up.

Params:

Direction:

        The direction to look towards.

Up:

        The up vector to rotate about.

Returns:

An MRotator rotation towards Direction about Up.



public MRotator

Add ()

Summary:

Adds a rotation to the respective rotation component.

Returns:

This MRotator after adding the deltas.



public MRotator

Add (MRotator DeltaPYR)

Summary:

Adds an MRotator to this MRotator on their respective components.

Params:

DeltaPYR:

        The MRotator to add.

Returns:

See Add(float DeltaPitch, float DeltaYaw, float DeltaRoll).



public MRotator

Oppose (ERotationAxis OpposeAxes)

Summary:

The opposite of this MRotator over OpposeAxes.

Params:

OpposeAxes:

        The axes to oppose.

Returns:

An MRotator in the opposite direction over the supplied axes.



public static MRotator

Interpolate (MRotator From, MRotator To, float Alpha, EEquation Equation)

Summary:

Interpolates between two MRotators.

Params:

From:

        The beginning rotation.

To:

        The target rotation.

Alpha:

        The percentage of interpolation.

Equation:

        The equation to interpolate. Default is Linear.

Returns:

An interpolated MRotator between From and To.



public static MRotator

Interpolate (MRotator From, MRotator To, float Alpha, AnimationCurve Curve)

Summary:

Interpolates between two MRotators.

Params:

From:

        The beginning rotation.

To:

        The target rotation.

Alpha:

        The percentage of interpolation.

Curve:

        The curve describing the speed of the interpolation.

Returns:

An interpolated MRotator between From and To.



public MVector

MV ()

Summary:

An MVector where X = Pitch, Y = Yaw, Z = Roll.



public MVector

Direction (MVector Forward)

Summary:

Gets the direction this MRotator is facing when facing forward.

Params:

Forward:

        Forward orientation.

Returns:

An MVector direction representing this Rotation.



public MVector

AsOrientationVector ()

Summary:

This Rotator as a directional Vector.

Returns:

An normalised MVector describing this MRotator.



public void

Wrap360 ()

Summary:

This MRotator % 360 on all components.



public MRotator

NormaliseAngles ()

Summary:

Forces the Angles to be within 0 - 360 degrees.

Returns:

The normalised MRotator.



public bool

IsZero (float ZeroThreshold)

Summary:

If this MRotator is Neutral, considering ZeroThreshold.

Params:

ZeroThreshold:

        The threshold to consider Zero. Default = kEpsilon.

Returns:

True if this MRotator is considered Neutral.



public static bool

ContainsNaN (MRotator R)

Summary:

Checks R's components for NaN.

Params:

R:

        The vector to check.

Returns:

True if R contains NaN.



public static MRotator operator+

operator+ (MRotator L, MRotator R)

Summary:

Adds two MRotators together.

Params:

L:

        Left-side MRotator.

R:

        Right-side MRotator.

Returns:

(MRotator L, MRotator R) => L.Add(R)



public static MRotator operator-

operator- (MRotator L, MRotator R)

Summary:

Subtracts R from L.

Params:

L:

        Left-side MRotator.

R:

        Right-side MRotator.

Returns:

L.Add(-R).



public static MRotator operator*

operator* (MRotator R, float S)

Summary:

Multiplies an MRotator by a Scalar value.

Params:

R:

        Rotator.

S:

        Scalar.

Returns:

R[P..Y..R] * S.



public static MRotator operator*

operator* (MRotator L, MRotator R)

Summary:

Apply Rotations L and R in sequence.

Remarks:

MRotator multiplications are not commutative. L * R != R * L.

Params:

L:

        First rotation.

R:

        Second rotation.

Returns:

An MRotator L rotated by R.



public static bool operator==

operator= (MRotator Left, MRotator Right)

Summary:

Compares two MRotators for equality.

Params:

Left:

        Left-side comparison.

Right:

        Right-side comparison.

Returns:

True if the square difference between Left and Right is less than kEpsilon ^ 2.



public static bool operator!=

operator!= (MRotator Left, MRotator Right)

Summary:

Compares two MRotators for inequality.

Params:

Left:

        Left-side comparison.

Right:

        Right-side comparison.

Returns:

The opposite of operator ==.



public static implicit operator Quaternion

MRotator -> Quaternion ()

Summary:

Converts Pitch, Yaw, Roll into its corresponding Quaternion.



public static MVector operator*

operator* (MRotator Rotation, MVector Vector)

Summary:

Rotate Vector by Rotation.



public static Vector3 operator*

operator* (MRotator Rotation, Vector3 Vector)

Summary:

Rotate Vector by Rotation.



public override int

GetHashCode ()

Summary:

Hash code for use in Maps, Sets, MArrays, etc.

Returns:

GetHashCode() => Pitch.GetHashCode() ^ (Yaw.GetHashCode() << 2) ^ (Roll.GetHashCode() >> 2)



public override string

ToString ()

Summary:

A human-readable MRotator.

Returns:

"Pitch: " + Pitch + " Yaw: " + Yaw + " Roll: " + Roll


public enum : byte

ERotationAxis


Rotation axes.


NoAxis

No Rotation axis.


Pitch

Rotation axis describing Pitch.


Yaw

Rotation axis describing Yaw.


Roll

Rotation axis describing Roll.