Quaternion
A Quaternion represents rotation and direction in 3D space, consisting of x, y, z, and w components. They are crucial for 3D movement and rotation, offering advantages such as avoiding gimbal lock. Unity's Quaternion Documentation
Properties
Returns the rotation of a Quaternion in Euler angles representation. Unity's Quaternion.eulerAngles Documentation
Represents a Quaternion for no rotation. Unity's Quaternion.identity Documentation
Returns a normalized copy of the Quaternion. Useful for ensuring the Quaternion has a magnitude of 1. Unity's Quaternion.normalized Documentation
Represents the w (scalar) component of the Quaternion. Unity's Quaternion.w Documentation
Represents the x component of the Quaternion. Unity's Quaternion.x Documentation
Represents the y component of the Quaternion. Unity's Quaternion.y Documentation
Represents the z component of the Quaternion. Unity's Quaternion.z Documentation
Methods
Returns the angle in degrees between two rotations. Unity's Quaternion.Angle Documentation
Parameters
The first rotation.
The second rotation.
Returns
The angle in degrees between the two rotations.
Creates a Quaternion rotation around an axis by a specified angle. Unity's Quaternion.AngleAxis Documentation
Parameters
angle
The angle of rotation.
axis
The rotation axis.
Returns
A Quaternion around the specified axis with the given angle.
Calculates the dot product of two quaternions. Unity's Quaternion.Dot Documentation
Parameters
The first quaternion.
The second quaternion.
Returns
The dot product of the two quaternions.
Checks if two Quaternions are equal. Unity's Quaternion.Equals Documentation
Parameters
other
The Quaternion to compare with.
Returns
Returns true if the Quaternions are equal.
Creates a Quaternion rotation from Euler angles. Unity's Quaternion.Euler Documentation
Parameters
euler
Returns
A Quaternion from the Euler angles.
Creates a Quaternion rotation from Euler angles. Unity's Quaternion.Euler Documentation
Parameters
x
The angle around the x-axis in degrees.
y
The angle around the y-axis in degrees.
z
The angle around the z-axis in degrees.
Returns
A Quaternion from the Euler angles.
Creates a Quaternion that rotates from one direction to another. Unity's Quaternion.FromToRotation Documentation
Returns
A rotation from fromDirection to toDirection.
Returns the inverse of the Quaternion. Unity's Quaternion.Inverse Documentation
Parameters
rotation
The rotation to inverse.
Returns
The inverse rotation.
Linearly interpolates between two quaternions. Unity's Quaternion.Lerp Documentation
Parameters
Returns
An interpolated quaternion rotation.
The 'LerpUnclamped' method is similar to Lerp, but here the interpolation factor isn't clamped to the range [0, 1]. Unity's Quaternion.LerpUnclamped Documentation
Parameters
The starting rotation.
The end rotation.
t
The unclamped interpolation amount.
Returns
Returns a Quaternion that is interpolated over an arbitrary range.
Provides a quaternion that makes an object face towards a specified direction. Unity's Quaternion.LookRotation Documentation
Parameters
forward
The direction to be faced.
Returns
A Quaternion that aligns an object's forward direction towards the specified direction.
Provides a quaternion that makes an object face towards a specified direction. Unity's Quaternion.LookRotation Documentation
Parameters
Returns
A Quaternion that aligns an object's forward direction towards the specified direction.
Multiplies two Quaternions together. Unity's Quaternion.Multiply Documentation
Parameters
lhs
The first Quaternion.
rhs
The second Quaternion.
Returns
The product of the two Quaternions.
Modifies the quaternion to a unit length version of itself. Unity's Quaternion.Normalize Documentation
Parameters
The Quaternion to be normalized.
Returns
The normalized version of the quaternion.
Modifies the quaternion to a unit length version of itself. Unity's Quaternion.Normalize Documentation
Returns
Gradually changes a Quaternion towards a target rotation. Unity's Quaternion.RotateTowards Documentation
Parameters
from
The current rotation.
The target rotation.
maxDegreesDelta
The maximum number of degrees to rotate by in each call.
Returns
A Quaternion rotated towards the target.
Assigns new values to the Quaternion's components. Unity's Quaternion.Set Documentation
Parameters
newX
The new x component.
newY
The new y component.
newZ
The new z component.
newW
The new w component.
Returns
Sets the Quaternion to rotate from one direction to another. Unity's Quaternion.SetFromToRotation Documentation
Aligns the Quaternion's z-axis towards a target direction. Unity's Quaternion.SetLookRotation Documentation
Parameters
view
The target direction vector.
Returns
Aligns the Quaternion's z-axis towards a target direction. Unity's Quaternion.SetLookRotation Documentation
Gradually changes a Quaternion from one rotation to another. Unity's Quaternion.Slerp Documentation
Parameters
Returns
An interpolated quaternion rotation.
Interpolates a Quaternion over an arbitrary range. Unity's Quaternion.SlerpUnclamped Documentation
Parameters
The starting rotation.
The end rotation.
t
The unclamped interpolation amount.
Returns
An interpolated quaternion rotation.
Updated 9 days ago