struct Rotation

book_4_sparkGenerated
code_blocksInput

Description

The Rotation struct represents a Quaternion rotation in s&box. It can be interpreted as a direction unit vector (x, y, z) plus a rotation around the direction vector (w), which represents the up direction. Unlike Angles, it cannot store multiple revolutions around an axis.

Members

Static Members

Member NameSummary
FromAxisCreates a rotation from an axis and angle in degrees.
FromCreates a rotation from pitch, yaw, and roll angles.
LookAtCreates a rotation that looks in the specified forward direction.
DifferenceCalculates the difference between two rotations.
LerpLinearly interpolates between two rotations.
SlerpSpherically interpolates between two rotations.
SmoothDampSmoothly dampens a rotation towards a target.
FromToRotationCreates a rotation that rotates from one direction to another.
ParseParses a string to create a rotation.
TryParseTries to parse a string to create a rotation.
RandomReturns a uniformly random rotation.
IdentityA rotation that represents no rotation.

Instance Members

Member NameSummary
DistanceCalculates the distance to another rotation.
AngleReturns the turn length of this rotation in degrees.
AnglesReturns this rotation as pitch, yaw, roll angles.
PitchReturns this rotation's pitch.
YawReturns this rotation's yaw.
RollReturns this rotation's roll.
LerpToInterpolates this rotation towards a target rotation.
SlerpToSpherically interpolates this rotation towards a target rotation.
ClampClamps the rotation to a maximum angle.
RotateAroundAxisRotates this rotation around a specified axis.
ClosestAxisFinds the closest axis to a given normal.

Properties

Property NameSummary
xThe X component of this rotation.
yThe Y component of this rotation.
zThe Z component of this rotation.
wThe W component of this rotation.
ForwardThe forward direction of this rotation.
BackwardThe backward direction of this rotation.
RightThe right hand direction of this rotation.
LeftThe left hand direction of this rotation.
UpThe upward direction of this rotation.
DownThe downward direction of this rotation.
InverseReturns the inverse of this rotation.
NormalNormalizes the rotation.
ConjugateReturns the conjugate of this rotation.