Rotationclass
Represents a Quaternion rotation. Can be interpreted as a direction unit vector (x,y,z) + rotation around the direction vector (w) which represents the up direction. Unlike `Angles`, this cannot store multiple revolutions around an axis.
Constructors3
Showing 3 constructors
No results match this filter.
Methods30
Showing 30 methods
public bool AlmostEqual(Rotation r, float delta = 1E-05)
Returns true if we're nearly equal to the passed rotation. Checks if each component is within a threshold, and handles the fact that there are two ways to represent the same rotation as a quaternion.
| Parameter | Type | Description |
|---|---|---|
| r | Rotation | The value to compare with |
| delta = 1E-05 | float | Per-component threshold. |
boolTrue if nearly equalpublic float Angle()
Returns the turn length of this rotation (from identity) in degrees
float—public Vector3 ClosestAxis(Vector3 normal)
Will give you the axis most aligned with the given normal
| Parameter | Type | Description |
|---|---|---|
| normal | Vector3 | — |
public static Rotation Difference(Rotation from, Rotation to)
Returns the difference between two rotations, as a rotation
| Parameter | Type | Description |
|---|---|---|
| from | Rotation | — |
| to | Rotation | — |
public float Distance(Rotation to)
The degree angular distance between this rotation and the target
| Parameter | Type | Description |
|---|---|---|
| to | Rotation | — |
float—public static Rotation FromAxis(Vector3 axis, float degrees)
Create from angle and an axis
Note
`axis` vector must be normalized before calling this method or the resulting `Rotation` will be incorrect.
| Parameter | Type | Description |
|---|---|---|
| axis | Vector3 | — |
| degrees | float | — |
public static Rotation FromPitch(float pitch)
Create a Rotation (quaternion) from pitch (degrees)
| Parameter | Type | Description |
|---|---|---|
| pitch | float | — |
public static Rotation FromRoll(float roll)
Create a Rotation (quaternion) from roll (degrees)
| Parameter | Type | Description |
|---|---|---|
| roll | float | — |
public static Rotation FromToRotation(Vector3 fromDirection, Vector3 toDirection)
Returns a Rotation that rotates from one direction to another.
| Parameter | Type | Description |
|---|---|---|
| fromDirection | Vector3 | — |
| toDirection | Vector3 | — |
public static Rotation FromYaw(float yaw)
Create a Rotation (quaternion) from yaw (degrees)
| Parameter | Type | Description |
|---|---|---|
| yaw | float | — |
public static Rotation Lerp(Rotation a, Rotation b, float frac, bool clamp = True)
Perform a linear interpolation from a to b by given amount.
| Parameter | Type | Description |
|---|---|---|
| a | Rotation | — |
| b | Rotation | — |
| frac | float | — |
| clamp = True | bool | — |
public Rotation LerpTo(Rotation target, float frac, bool clamp = True)
Perform a linear interpolation from this rotation to a target rotation by given amount.
| Parameter | Type | Description |
|---|---|---|
| target | Rotation | — |
| frac | float | — |
| clamp = True | bool | — |
public float Pitch()
Return this Rotation pitch
float—public float Roll()
Return this Rotation roll
float—public Rotation RotateAroundAxis(Vector3 axis, float degrees)
A convenience function that rotates this rotation around a given axis given amount of degrees
Note
`axis` vector must be normalized before calling this method or the resulting `Rotation` will be incorrect.
| Parameter | Type | Description |
|---|---|---|
| axis | Vector3 | — |
| degrees | float | — |
public static Rotation Slerp(Rotation a, Rotation b, float amount, bool clamp = True)
Perform a spherical interpolation from a to b by given amount.
| Parameter | Type | Description |
|---|---|---|
| a | Rotation | — |
| b | Rotation | — |
| amount | float | — |
| clamp = True | bool | — |
public Rotation SlerpTo(Rotation target, float frac, bool clamp = True)
Perform a spherical interpolation from this rotation to a target rotation by given amount.
| Parameter | Type | Description |
|---|---|---|
| target | Rotation | — |
| frac | float | — |
| clamp = True | bool | — |
public static Rotation SmoothDamp(Rotation current, Rotation target, Vector3 velocity, float smoothTime, float deltaTime)
Smoothly move towards the target rotation
| Parameter | Type | Description |
|---|---|---|
| current | Rotation | — |
| target | Rotation | — |
| velocity | Vector3 | — |
| smoothTime | float | — |
| deltaTime | float | — |
public float Yaw()
Return this Rotation yaw
float—No results match this filter.
Properties14
Showing 14 properties
public Rotation Rotation.Conjugate { get; set; }
Returns conjugate of this rotation, meaning the X Y and Z components are negated.
public Rotation Rotation.Normal { get; set; }
Divides each component of the rotation by its length, normalizing the rotation.
public float Rotation.w { get; set; }
The W component of this rotation (rotation around the normal defined by X,Y,Z components).
float—public float Rotation.x { get; set; }
The X component of this rotation.
float—public float Rotation.y { get; set; }
The Y component of this rotation.
float—public float Rotation.z { get; set; }
The Z component of this rotation.
float—No results match this filter.