![]() |
GearBlocks
The GearBlocks Lua scripting API
|
A quaternion. More...
Public Member Functions | |
QuaternionProxy (float x, float y, float z, float w) | |
Constructor. | |
void | Set (float newX, float newY, float newZ, float newW) |
Set the components of a quaternion. | |
void | SetFromToRotation (Vector3Proxy fromDirection, Vector3Proxy toDirection) |
Set the quaternion to a rotation between two directions. | |
void | SetLookRotation (Vector3Proxy forward) |
Set the quaternion to a rotation that points in a direction. | |
void | SetLookRotation (Vector3Proxy forward, Vector3Proxy up) |
Set the quaternion to a rotation that points in a direction. | |
void | ToAngleAxis (out float angle, out Vector3Proxy axis) |
Convert the quaternion to an angle-axis representation. | |
Static Public Member Functions | |
static QuaternionProxy | AngleAxis (float angle, Vector3Proxy axis) |
Create a quaternion from an angle-axis representation. | |
static QuaternionProxy | Euler (float x, float y, float z) |
Create a quaternion from an euler angle representation. | |
static QuaternionProxy | Euler (Vector3Proxy euler) |
Create a quaternion from an euler angle representation. | |
static QuaternionProxy | FromToRotation (Vector3Proxy fromDirection, Vector3Proxy toDirection) |
Create a quaternion with a rotation between two directions. | |
static QuaternionProxy | LookRotation (Vector3Proxy forward) |
Create a quaternion with a rotation that points in a direction. | |
static QuaternionProxy | LookRotation (Vector3Proxy forward, Vector3Proxy up) |
Create a quaternion with a rotation that points in a direction. | |
static QuaternionProxy | Normalize (QuaternionProxy a) |
Normalise a quaternion to a magnitude of 1. | |
static QuaternionProxy | Inverse (QuaternionProxy a) |
Get the inverse of a quaternion. | |
static float | Angle (QuaternionProxy a, QuaternionProxy b) |
Get the angle between two quaternion rotations. | |
static float | Dot (QuaternionProxy a, QuaternionProxy b) |
Get the dot product between two quaternions. | |
static QuaternionProxy | Lerp (QuaternionProxy a, QuaternionProxy b, float t) |
Linearly interpolate between two quaternions by t (clamping t to [0, 1]). | |
static QuaternionProxy | LerpUnclamped (QuaternionProxy a, QuaternionProxy b, float t) |
Linearly interpolate between two quaternions by t (not clamping t). | |
static QuaternionProxy | Slerp (QuaternionProxy a, QuaternionProxy b, float t) |
Spherically interpolate between two quaternions by t (clamping t to [0, 1]). | |
static QuaternionProxy | SlerpUnclamped (QuaternionProxy a, QuaternionProxy b, float t) |
Spherically interpolate between two quaternions by t (not clamping t). | |
static QuaternionProxy | RotateTowards (QuaternionProxy fromRotation, QuaternionProxy toRotation, float step) |
Create a quaternion with a rotation from "fromRotation" towards "toRotation". | |
static QuaternionProxy | SnapAngles (QuaternionProxy q, float snapIntervalAngle) |
Snap a quaternion's euler angles. | |
static Vector3Proxy | operator* (QuaternionProxy rotation, Vector3Proxy point) |
Rotate a point vector by a quaternion. | |
static QuaternionProxy | operator* (QuaternionProxy a, QuaternionProxy b) |
Combine two quaternion rotations. | |
static bool | operator== (QuaternionProxy a, QuaternionProxy b) |
Compare two quaternions. | |
static bool | operator!= (QuaternionProxy a, QuaternionProxy b) |
Compare two quaternions. | |
Properties | |
float | X [get, set] |
The quaternion's x component. | |
float | Y [get, set] |
The quaternion's y component. | |
float | Z [get, set] |
The quaternion's z component. | |
float | W [get, set] |
The quaternion's w component. | |
float | this[int index] [get, set] |
The quaternion component at the specified index. | |
static QuaternionProxy | Identity [get] |
The identity quaternion. | |
Vector3Proxy | EulerAngles [get, set] |
The euler angle representation of the quaternion. | |
QuaternionProxy | Normalized [get] |
The normalised quaternion. | |
readonly float | Magnitude [get] |
The quaternion's magnitude. | |
A quaternion.
Static methods available in Lua via the "Quaternion" global, for example:
SmashHammer.Scripting.QuaternionProxy.QuaternionProxy | ( | float | x, |
float | y, | ||
float | z, | ||
float | w | ||
) |
Constructor.
x | The x component to initialise with. |
y | The y component to initialise with. |
z | The z component to initialise with. |
w | The w component to initialise with. |
|
static |
Create a quaternion from an angle-axis representation.
angle | Angle around the axis. |
axis | Rotation axis. |
|
static |
Create a quaternion from an euler angle representation.
x | Rotation angle around x axis. |
y | Rotation angle around y axis. |
z | Rotation angle around z axis. |
|
static |
Create a quaternion from an euler angle representation.
euler | A vector containing the euler angles. |
|
static |
Create a quaternion with a rotation between two directions.
fromDirection | Direction to rotate from. |
toDirection | Direction to rotate to. |
|
static |
Create a quaternion with a rotation that points in a direction.
forward | Direction to point in. |
|
static |
Create a quaternion with a rotation that points in a direction.
forward | Direction to point in. |
up | Specifies the up direction. |
|
static |
Normalise a quaternion to a magnitude of 1.
a | The quaternion to normalise. |
|
static |
Get the inverse of a quaternion.
a | The quaternion to invert. |
|
static |
Get the angle between two quaternion rotations.
a | The first quaternion. |
b | The second quaternion. |
|
static |
Get the dot product between two quaternions.
a | The first quaternion. |
b | The second quaternion. |
|
static |
Linearly interpolate between two quaternions by t (clamping t to [0, 1]).
a | The first quaternion. |
b | The second quaternion. |
t | The interpolation amount. |
|
static |
Linearly interpolate between two quaternions by t (not clamping t).
a | The first quaternion. |
b | The second quaternion. |
t | The interpolation amount. |
|
static |
Spherically interpolate between two quaternions by t (clamping t to [0, 1]).
a | The first quaternion. |
b | The second quaternion. |
t | The interpolation amount. |
|
static |
Spherically interpolate between two quaternions by t (not clamping t).
a | The first quaternion. |
b | The second quaternion. |
t | The interpolation amount. |
|
static |
Create a quaternion with a rotation from "fromRotation" towards "toRotation".
fromRotation | Rotate from. |
toRotation | Rotate to. |
step | Angular step to rotate by. |
|
static |
Snap a quaternion's euler angles.
q | The quaternion to snap. |
snapIntervalAngle | The interval to snap angles by. |
|
static |
Rotate a point vector by a quaternion.
rotation | The rotation quaternion. |
point | The point vector. |
|
static |
Combine two quaternion rotations.
a | The first quaternion. |
b | The second quaternion. |
|
static |
Compare two quaternions.
a | The first quaternion. |
b | The second quaternion. |
true
if the quaternions are equal; otherwise, false
.
|
static |
Compare two quaternions.
a | The first quaternion. |
b | The second quaternion. |
true
if the quaternions are not equal; otherwise, false
.void SmashHammer.Scripting.QuaternionProxy.Set | ( | float | newX, |
float | newY, | ||
float | newZ, | ||
float | newW | ||
) |
Set the components of a quaternion.
newX | The x component of the quaternion. |
newY | The y component of the quaternion. |
newZ | The z component of the quaternion. |
newW | The w component of the quaternion. |
void SmashHammer.Scripting.QuaternionProxy.SetFromToRotation | ( | Vector3Proxy | fromDirection, |
Vector3Proxy | toDirection | ||
) |
Set the quaternion to a rotation between two directions.
fromDirection | Direction to rotate from. |
toDirection | Direction to rotate to. |
void SmashHammer.Scripting.QuaternionProxy.SetLookRotation | ( | Vector3Proxy | forward | ) |
Set the quaternion to a rotation that points in a direction.
forward | Direction to point in. |
void SmashHammer.Scripting.QuaternionProxy.SetLookRotation | ( | Vector3Proxy | forward, |
Vector3Proxy | up | ||
) |
Set the quaternion to a rotation that points in a direction.
forward | Direction to point in. |
up | Specifies the up direction. |
void SmashHammer.Scripting.QuaternionProxy.ToAngleAxis | ( | out float | angle, |
out Vector3Proxy | axis | ||
) |
Convert the quaternion to an angle-axis representation.
angle | Angle around the axis. |
axis | Rotation axis. |
|
getset |
The quaternion's x component.
The x component of this quaternion.
|
getset |
The quaternion's y component.
The y component of this quaternion.
|
getset |
The quaternion's z component.
The z component of this quaternion.
|
getset |
The quaternion's w component.
The w component of this quaternion.
|
getset |
The quaternion component at the specified index.
index | The component index:-
|
The quaternion component.
|
staticget |
The identity quaternion.
A new quaternion initialised to the identity rotation.
|
getset |
The euler angle representation of the quaternion.
A vector containing the euler angles.
|
get |
The normalised quaternion.
This quaternion normalised to a magnitude of 1.
|
get |
The quaternion's magnitude.
The magnitude of this quaternion.