S&box Wiki


Represents a Quaternion rotation.



Vector3 Backward { get; }
Vector3 Down { get; }
Vector3 Forward { get; }
Rotation Inverse { get; }
Returns the inverse of this rotation
Vector3 Left { get; }
Rotation Normal { get; }
Vector3 Right { get; }
Vector3 Up { get; }
float w { get; set; }
float x { get; set; }
float y { get; set; }
float z { get; set; }


float Angle()
Returns the turn length of this rotation (from identity) in degrees
Angles Angles()
Return this Rotation as pitch, yaw, roll angles
Rotation Clamp( Rotation to, float degrees, float change )
Clamp to within degrees of passed rotation. Also pases out the change in degrees, if any.
static Rotation Difference( Rotation from, Rotation to )
Returns the difference between two rotations, as a rotation
float Distance( Rotation to )
The degree angular distance between this rotation and the target
static Rotation From( float pitch, float yaw, float roll )
Create a Rotation (quaternion) from pitch yaw roll (degrees)
static Rotation FromAxis( Vector3 axis, float degrees )
Create from angle and an axis
static Rotation FromPitch( float pitch )
Create a Rotation (quaternion) from pitch (degrees)
static Rotation FromRoll( float roll )
Create a Rotation (quaternion) from roll (degrees)
static Rotation FromYaw( float yaw )
Create a Rotation (quaternion) from yaw (degrees)
static Rotation Lerp( Rotation a, Rotation b, float amount, bool clamp = True )
Lerp from a to b by amount
static Rotation LookAt( Vector3 forward )
Create a Rotation (quaternion) from a forward and up vector
static Rotation Parse( string str )
Given a string, try to convert this into a quaternion rotation. The format is "x,y,z,w"
float Pitch()
Return this Rotation pitch
Rotation Read( System.IO.BinaryReader reader )
float Roll()
Return this Rotation roll
Rotation RotateAroundAxis( Vector3 axis, float degrees )
A convenience function that rotates this rotation around a given axis given amount of degrees
static Rotation Slerp( Rotation a, Rotation b, float amount, bool clamp = True )
Slerp from a to b by amount
float Yaw()
Return this Rotation yaw