s&box docs

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.

Broader workflow and conceptual references connected to this API.

Constructors

Showing 4 constructors

Methods

Showing 17 methods

public static Vector3 AngleVector(Angles ang)

Converts an angle to a forward vector.

public Vector3 AsVector3()

Return as a Vector3, where x = pitch etc

public static float ClampAngle(float v)

Clamps the angle to range of [0, 360)

public Angles Clamped()

Returns clamped version of this object, meaning the angle on each axis is transformed to range of [0,360).

public bool IsNearlyZero(double tolerance = 1E-06)

Returns true if this angles object's components are all nearly zero with given tolerance.

Parameters

  • tolerance: Default: 1E-06

public static Angles Lerp(Angles source, Angles target, float frac)

Performs linear interpolation on the two given angle objects.

Parameters

  • source: Angle A
  • target: Angle B
  • frac: Fraction in range [0,1] between the 2 angle objects to use for interpolation.

public Angles LerpTo(Angles target, float frac)

Performs linear interpolation on the two given angle objects.

Parameters

  • target: Angle B
  • frac: Fraction in range [0,1] between the 2 angle objects to use for interpolation.

public static float NormalizeAngle(float v)

Normalizes the angle to range of (-180, 180]

public Angles SnapToGrid(float gridSize, bool sx = True, bool sy = True, bool sz = True)

Snap to grid

Parameters

  • sx: Default: True
  • sy: Default: True
  • sz: Default: True

public Rotation ToRotation()

Converts these Euler angles to a rotation. The angles will be normalized.

public Angles WithPitch(float pitch)

Returns this angles object with given pitch component.

public Angles WithRoll(float roll)

Returns this angles object with given roll component.

public Angles WithYaw(float yaw)

Returns this angles object with given yaw component.

Properties

Showing 3 properties

public Vector3 Angles.Forward { get; set; }

The forward direction vector for this angle.

public Angles Angles.Normal { get; set; }

Returns normalized version of this object, meaning the angle on each axis is normalized to range of (-180,180].

public static Angles Angles.Random { get; set; }

Returns the angles of a uniformly random rotation.

Metadata

FieldValue
Namespaceglobal
Typeclass
AssemblySandbox.System
Doc IDT:Angles

On this page