Angles
public sealed struct Angles Euler angles. Unlike a Rotation, Euler angles can represent multiple revolutions (rotations) around an axis, but suffer from issues like gimbal lock and lack of a defined "up" vector. Use Rotation for most cases.
Constructors
Angles(Single pitch, Single yaw, Single roll) Initializes the angles object with given components.
pitch — The Pitch component. yaw — The Yaw component. roll — The roll component. Angles(Angles other) Copies values of given angles object.
Angles(Vector3 vector) Where x, y and z represent the pitch, yaw and roll respectively.
Angles(Single all) Initializes the angles object with all components set to given value.
Properties
Methods
Rotation ToRotation() Converts these Euler angles to a rotation. The angles will be normalized.
Vector3 AsVector3() Return as a Vector3, where x = pitch etc
Boolean IsNearlyZero(Double tolerance = 1E-06) Returns true if this angles object's components are all nearly zero with given tolerance.
Angles WithPitch(Single pitch) Returns this angles object with given pitch component.
Angles WithYaw(Single yaw) Returns this angles object with given yaw component.
Angles WithRoll(Single roll) Returns this angles object with given roll component.
static Angles Parse(String str) Given a string, try to convert this into an angles object. The format is "p,y,r".
static override Angles Parse(String str, IFormatProvider provider) static Boolean TryParse(String str, Angles result) static override Boolean TryParse(String str, IFormatProvider provider, Angles result) Angles Clamped() Returns clamped version of this object, meaning the angle on each axis is transformed to range of [0,360).
static Single ClampAngle(Single v) Clamps the angle to range of [0, 360)
static Single NormalizeAngle(Single v) Normalizes the angle to range of (-180, 180]
static Angles Lerp(Angles source, Angles target, Single frac) Performs linear interpolation on the two given angle objects.
source — Angle A target — Angle B frac — Fraction in range [0,1] between the 2 angle objects to use for interpolation. Angles LerpTo(Angles target, Single frac) Performs linear interpolation on the two given angle objects.
target — Angle B frac — Fraction in range [0,1] between the 2 angle objects to use for interpolation. Angles SnapToGrid(Single gridSize, Boolean sx = True, Boolean sy = True, Boolean sz = True) Snap to grid
Fields
| Name | Type | Description |
|---|---|---|
pitch | Single | The pitch component, typically up/down. |
yaw | Single | The yaw component, typically left/right. |
roll | Single | The roll component, basically rotation around the axis. |
Zero static | Angles | An angle constant that has all its values set to 0. Use this instead of making a static 0,0,0 object yourself. |
Sandbox.System Full Name: Angles