Search Results for

    Show / Hide Table of Contents

    Struct Quaternion

    Implements
    IEquatable<Quaternion>
    Inherited Members
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Namespace: GTA.Math
    Assembly: ScriptHookVDotNet3.dll
    Syntax
    [Serializable]
    public struct Quaternion : IEquatable<Quaternion>

    Constructors

    | Improve this Doc View Source

    Quaternion(Vector3, Single)

    Initializes a new instance of the Quaternion structure.

    Declaration
    public Quaternion(Vector3 axis, float angle)
    Parameters
    Type Name Description
    Vector3 axis

    The axis of rotation.

    Single angle

    The angle of rotation in radians.

    | Improve this Doc View Source

    Quaternion(Single, Single, Single, Single)

    Initializes a new instance of the Quaternion structure.

    Declaration
    public Quaternion(float x, float y, float z, float w)
    Parameters
    Type Name Description
    Single x

    The X component of the quaternion.

    Single y

    The Y component of the quaternion.

    Single z

    The Z component of the quaternion.

    Single w

    The W component of the quaternion.

    Fields

    | Improve this Doc View Source

    W

    Gets or sets the W component of the quaternion.

    Declaration
    public float W
    Field Value
    Type Description
    Single

    The W component of the quaternion.

    | Improve this Doc View Source

    X

    Gets or sets the X component of the quaternion.

    Declaration
    public float X
    Field Value
    Type Description
    Single

    The X component of the quaternion.

    | Improve this Doc View Source

    Y

    Gets or sets the Y component of the quaternion.

    Declaration
    public float Y
    Field Value
    Type Description
    Single

    The Y component of the quaternion.

    | Improve this Doc View Source

    Z

    Gets or sets the Z component of the quaternion.

    Declaration
    public float Z
    Field Value
    Type Description
    Single

    The Z component of the quaternion.

    Properties

    | Improve this Doc View Source

    Angle

    Gets the angle of the quaternion.

    Declaration
    public readonly float Angle { get; }
    Property Value
    Type Description
    Single
    | Improve this Doc View Source

    Axis

    Gets the axis components of the quaternion.

    Declaration
    public readonly Vector3 Axis { get; }
    Property Value
    Type Description
    Vector3
    | Improve this Doc View Source

    Identity

    The identity Quaternion (0, 0, 0, 1).

    Declaration
    public static readonly Quaternion Identity { get; }
    Property Value
    Type Description
    Quaternion
    | Improve this Doc View Source

    One

    A Quaternion with all of its components set to one.

    Declaration
    public static readonly Quaternion One { get; }
    Property Value
    Type Description
    Quaternion
    | Improve this Doc View Source

    Zero

    A Quaternion with all of its components set to zero.

    Declaration
    public static readonly Quaternion Zero { get; }
    Property Value
    Type Description
    Quaternion

    Methods

    | Improve this Doc View Source

    Add(Quaternion, Quaternion)

    Adds two quaternions.

    Declaration
    public static Quaternion Add(Quaternion left, Quaternion right)
    Parameters
    Type Name Description
    Quaternion left

    The first quaternion to add.

    Quaternion right

    The second quaternion to add.

    Returns
    Type Description
    Quaternion

    The sum of the two quaternions.

    | Improve this Doc View Source

    AngleBetween(Quaternion, Quaternion)

    Returns the angle in degrees between two rotations a and b.

    Declaration
    public static float AngleBetween(Quaternion a, Quaternion b)
    Parameters
    Type Name Description
    Quaternion a

    The first quaternion to calculate angle.

    Quaternion b

    The second quaternion to calculate angle.

    Returns
    Type Description
    Single

    The angle in degrees between two rotations a and b.

    | Improve this Doc View Source

    Conjugate()

    Conjugates the quaternion.

    Declaration
    public void Conjugate()
    | Improve this Doc View Source

    Conjugate(Quaternion)

    Creates the conjugate of a specified Quaternion.

    Declaration
    public static Quaternion Conjugate(Quaternion value)
    Parameters
    Type Name Description
    Quaternion value

    The Quaternion of which to return the conjugate.

    Returns
    Type Description
    Quaternion

    A new Quaternion that is the conjugate of the specified one.

    | Improve this Doc View Source

    DirectionVectors(Vector3, Vector3, Vector3)

    Creates a Quaternion from the given relative x, y, z axis

    Declaration
    public static Quaternion DirectionVectors(Vector3 rightVector, Vector3 forwardVector, Vector3 upVector)
    Parameters
    Type Name Description
    Vector3 rightVector

    Relative X axis

    Vector3 forwardVector

    Relative Y axis

    Vector3 upVector

    Relative Z axis

    Returns
    Type Description
    Quaternion

    The newly created quaternion.

    | Improve this Doc View Source

    Divide(Quaternion, Quaternion)

    Divides a quaternion by another.

    Declaration
    public static Quaternion Divide(Quaternion left, Quaternion right)
    Parameters
    Type Name Description
    Quaternion left

    The first quaternion to divide.

    Quaternion right

    The second quaternion to divide.

    Returns
    Type Description
    Quaternion

    The divided quaternion.

    | Improve this Doc View Source

    Dot(Quaternion, Quaternion)

    Calculates the dot product of two quaternions.

    Declaration
    public static float Dot(Quaternion left, Quaternion right)
    Parameters
    Type Name Description
    Quaternion left

    First source quaternion.

    Quaternion right

    Second source quaternion.

    Returns
    Type Description
    Single

    The dot product of the two quaternions.

    | Improve this Doc View Source

    Equals(Quaternion)

    Returns a value that indicates whether the current instance is equal to the specified object.

    Declaration
    public bool Equals(Quaternion other)
    Parameters
    Type Name Description
    Quaternion other

    Object to make the comparison with.

    Returns
    Type Description
    Boolean

    true if the current instance is equal to the specified object; false otherwise.

    | Improve this Doc View Source

    Equals(Object)

    Returns a value that indicates whether the current instance is equal to a specified object.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    Object obj

    Object to make the comparison with.

    Returns
    Type Description
    Boolean

    true if the current instance is equal to the specified object; false otherwise.

    Overrides
    ValueType.Equals(Object)
    | Improve this Doc View Source

    Euler(Vector3)

    Returns a rotation that rotates z degrees around the z axis, x degrees around the x axis, and y degrees around the y axis (in that order).

    Declaration
    public static Quaternion Euler(Vector3 euler)
    Parameters
    Type Name Description
    Vector3 euler

    Euler angles in degrees. euler.X = around X axis, euler.Y = around Y axis, euler.Z = around Z axis

    Returns
    Type Description
    Quaternion
    | Improve this Doc View Source

    Euler(Single, Single, Single)

    Returns a rotation that rotates z degrees around the z axis, x degrees around the x axis, and y degrees around the y axis (in that order).

    Declaration
    public static Quaternion Euler(float zaxis, float xaxis, float yaxis)
    Parameters
    Type Name Description
    Single zaxis

    Z degrees.

    Single xaxis

    X degrees.

    Single yaxis

    Y degrees.

    Returns
    Type Description
    Quaternion
    | Improve this Doc View Source

    FromToRotation(Vector3, Vector3)

    Creates a rotation which rotates from fromDirection to toDirection.

    Declaration
    public static Quaternion FromToRotation(Vector3 fromDirection, Vector3 toDirection)
    Parameters
    Type Name Description
    Vector3 fromDirection
    Vector3 toDirection
    Returns
    Type Description
    Quaternion
    | Improve this Doc View Source

    GetDirectionVectors(Quaternion, out Vector3, out Vector3, out Vector3)

    Get direction vectors from the given quaternion

    Declaration
    public static void GetDirectionVectors(Quaternion quaternion, out Vector3 rightVector, out Vector3 forwardVector, out Vector3 upVector)
    Parameters
    Type Name Description
    Quaternion quaternion

    The quaternion

    Vector3 rightVector

    RightVector = relative x axis

    Vector3 forwardVector

    ForwardVector = relative y axis

    Vector3 upVector

    UpVector = relative z axis

    | Improve this Doc View Source

    GetHashCode()

    Returns the hash code for this instance.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32

    A 32-bit signed integer hash code.

    Overrides
    ValueType.GetHashCode()
    | Improve this Doc View Source

    Invert()

    Conjugates and renormalizes the quaternion.

    Declaration
    public void Invert()
    | Improve this Doc View Source

    Invert(Quaternion)

    Conjugates and renormalizes the quaternion.

    Declaration
    public static Quaternion Invert(Quaternion quaternion)
    Parameters
    Type Name Description
    Quaternion quaternion

    The quaternion to conjugate and re-normalize.

    Returns
    Type Description
    Quaternion

    The conjugated and renormalized quaternion.

    | Improve this Doc View Source

    Length()

    Calculates the length of the quaternion.

    Declaration
    public float Length()
    Returns
    Type Description
    Single

    The length of the quaternion.

    | Improve this Doc View Source

    LengthSquared()

    Calculates the squared length of the quaternion.

    Declaration
    public float LengthSquared()
    Returns
    Type Description
    Single

    The squared length of the quaternion.

    | Improve this Doc View Source

    Lerp(Quaternion, Quaternion, Single)

    Performs a linear interpolation between two quaternion.

    Declaration
    public static Quaternion Lerp(Quaternion start, Quaternion end, float amount)
    Parameters
    Type Name Description
    Quaternion start

    Start quaternion.

    Quaternion end

    End quaternion.

    Single amount

    Value between 0 and 1 indicating the weight of end.

    Returns
    Type Description
    Quaternion

    The linear interpolation of the two quaternions.

    Remarks

    This method performs the linear interpolation based on the following formula.

    start + (end - start) * amount

    Passing amount a value of 0 will cause start to be returned; a value of 1 will cause end to be returned.

    | Improve this Doc View Source

    LookRotation(Vector3)

    Creates a rotation with the specified forward and WorldUp directions.

    Declaration
    public static Quaternion LookRotation(Vector3 forward)
    Parameters
    Type Name Description
    Vector3 forward
    Returns
    Type Description
    Quaternion
    | Improve this Doc View Source

    LookRotation(Vector3, Vector3)

    Creates a rotation with the specified forward and up directions.

    Declaration
    public static Quaternion LookRotation(Vector3 forward, Vector3 up)
    Parameters
    Type Name Description
    Vector3 forward
    Vector3 up
    Returns
    Type Description
    Quaternion
    | Improve this Doc View Source

    Multiply(Quaternion, Quaternion)

    Multiplies two Quaternions together.

    Declaration
    public static Quaternion Multiply(Quaternion left, Quaternion right)
    Parameters
    Type Name Description
    Quaternion left

    The Quaternion on the left side of the multiplication.

    Quaternion right

    The Quaternion on the right side of the multiplication.

    Returns
    Type Description
    Quaternion

    The result of the multiplication.

    | Improve this Doc View Source

    Multiply(Quaternion, Single)

    Scales a quaternion by the given value.

    Declaration
    public static Quaternion Multiply(Quaternion quaternion, float scale)
    Parameters
    Type Name Description
    Quaternion quaternion

    The quaternion to scale.

    Single scale

    The amount by which to scale the quaternion.

    Returns
    Type Description
    Quaternion

    The scaled quaternion.

    | Improve this Doc View Source

    Negate(Quaternion)

    Reverses the direction of a given quaternion.

    Declaration
    public static Quaternion Negate(Quaternion quaternion)
    Parameters
    Type Name Description
    Quaternion quaternion

    The quaternion to negate.

    Returns
    Type Description
    Quaternion

    A quaternion facing in the opposite direction.

    | Improve this Doc View Source

    Normalize()

    Converts the quaternion into a unit quaternion.

    Declaration
    public void Normalize()
    | Improve this Doc View Source

    Normalize(Quaternion)

    Converts the quaternion into a unit quaternion.

    Declaration
    public static Quaternion Normalize(Quaternion quaternion)
    Parameters
    Type Name Description
    Quaternion quaternion

    The quaternion to normalize.

    Returns
    Type Description
    Quaternion

    The normalized quaternion.

    | Improve this Doc View Source

    RotateTowards(Quaternion, Quaternion, Single)

    Rotates a rotation from towards to.

    Declaration
    public static Quaternion RotateTowards(Quaternion from, Quaternion to, float maxDegreesDelta)
    Parameters
    Type Name Description
    Quaternion from

    From Quaternion.

    Quaternion to

    To Quaternion.

    Single maxDegreesDelta
    Returns
    Type Description
    Quaternion
    | Improve this Doc View Source

    RotateTransform(Quaternion, Vector3)

    Rotates the point with rotation.

    Declaration
    public static Vector3 RotateTransform(Quaternion rotation, Vector3 point)
    Parameters
    Type Name Description
    Quaternion rotation

    The quaternion to rotate the vector.

    Vector3 point

    The vector to be rotated.

    Returns
    Type Description
    Vector3

    The vector after rotation.

    | Improve this Doc View Source

    RotateTransform(Quaternion, Vector3, Vector3)

    Rotates the point with rotation.

    Declaration
    public static Vector3 RotateTransform(Quaternion rotation, Vector3 point, Vector3 center)
    Parameters
    Type Name Description
    Quaternion rotation

    The quaternion to rotate the vector.

    Vector3 point

    The vector to be rotated.

    Vector3 center

    The vector representing the origin of the new coordinate system.

    Returns
    Type Description
    Vector3

    The vector after rotation in the original coordinate system.

    | Improve this Doc View Source

    RotateTransform(Vector3)

    Rotates the point with rotation.

    Declaration
    public Vector3 RotateTransform(Vector3 point)
    Parameters
    Type Name Description
    Vector3 point

    The vector to be rotated.

    Returns
    Type Description
    Vector3

    The vector after rotation.

    | Improve this Doc View Source

    RotateTransform(Vector3, Vector3)

    Rotates the point with rotation.

    Declaration
    public Vector3 RotateTransform(Vector3 point, Vector3 center)
    Parameters
    Type Name Description
    Vector3 point

    The vector to be rotated.

    Vector3 center

    The vector representing the origin of the new coordinate system.

    Returns
    Type Description
    Vector3

    The vector after rotation in the original coordinate system.

    | Improve this Doc View Source

    RotationAxis(Vector3, Single)

    Creates a quaternion given a rotation and an axis.

    Declaration
    public static Quaternion RotationAxis(Vector3 axis, float angle)
    Parameters
    Type Name Description
    Vector3 axis

    The axis of rotation.

    Single angle

    The angle of rotation in radians.

    Returns
    Type Description
    Quaternion

    The newly created quaternion.

    | Improve this Doc View Source

    RotationMatrix(Matrix)

    Creates a quaternion given a rotation matrix.

    Declaration
    public static Quaternion RotationMatrix(Matrix matrix)
    Parameters
    Type Name Description
    Matrix matrix

    The rotation matrix.

    Returns
    Type Description
    Quaternion

    The newly created quaternion.

    | Improve this Doc View Source

    RotationYawPitchRoll(Single, Single, Single)

    Creates a Quaternion from the given yaw, pitch, and roll, in radians.

    Declaration
    public static Quaternion RotationYawPitchRoll(float yaw, float pitch, float roll)
    Parameters
    Type Name Description
    Single yaw

    The yaw angle, in radians, around the Z-axis.

    Single pitch

    The pitch angle, in radians, around the X-axis.

    Single roll

    The roll angle, in radians, around the Y-axis.

    Returns
    Type Description
    Quaternion

    The newly created quaternion.

    | Improve this Doc View Source

    Slerp(Quaternion, Quaternion, Single)

    Interpolates between two quaternions, using spherical linear interpolation..

    Declaration
    public static Quaternion Slerp(Quaternion start, Quaternion end, float amount)
    Parameters
    Type Name Description
    Quaternion start

    Start quaternion.

    Quaternion end

    End quaternion.

    Single amount

    Value between 0 and 1 indicating the weight of end.

    Returns
    Type Description
    Quaternion

    The spherical linear interpolation of the two quaternions.

    | Improve this Doc View Source

    SlerpUnclamped(Quaternion, Quaternion, Single)

    Interpolates between two quaternions, using spherical linear interpolation. The parameter /t/ is not clamped.

    Declaration
    public static Quaternion SlerpUnclamped(Quaternion a, Quaternion b, float t)
    Parameters
    Type Name Description
    Quaternion a
    Quaternion b
    Single t
    Returns
    Type Description
    Quaternion
    | Improve this Doc View Source

    Subtract(Quaternion, Quaternion)

    Subtracts two quaternions.

    Declaration
    public static Quaternion Subtract(Quaternion left, Quaternion right)
    Parameters
    Type Name Description
    Quaternion left

    The first quaternion to subtract.

    Quaternion right

    The second quaternion to subtract.

    Returns
    Type Description
    Quaternion

    The difference of the two quaternions.

    | Improve this Doc View Source

    ToString()

    Converts the value of the object to its equivalent string representation.

    Declaration
    public override string ToString()
    Returns
    Type Description
    String

    The string representation of the value of this instance.

    Overrides
    ValueType.ToString()
    | Improve this Doc View Source

    ToString(String)

    Converts the value of the object to its equivalent string representation.

    Declaration
    public string ToString(string format)
    Parameters
    Type Name Description
    String format

    The format.

    Returns
    Type Description
    String

    The string representation of the value of this instance.

    Operators

    | Improve this Doc View Source

    Addition(Quaternion, Quaternion)

    Adds two quaternions.

    Declaration
    public static Quaternion operator +(Quaternion left, Quaternion right)
    Parameters
    Type Name Description
    Quaternion left

    The first quaternion to add.

    Quaternion right

    The second quaternion to add.

    Returns
    Type Description
    Quaternion

    The sum of the two quaternions.

    | Improve this Doc View Source

    Division(Quaternion, Quaternion)

    Divides a Quaternion by another Quaternion.

    Declaration
    public static Quaternion operator /(Quaternion left, Quaternion right)
    Parameters
    Type Name Description
    Quaternion left

    The source Quaternion.

    Quaternion right

    The divisor.

    Returns
    Type Description
    Quaternion

    The result of the division.

    | Improve this Doc View Source

    Equality(Quaternion, Quaternion)

    Tests for equality between two objects.

    Declaration
    public static bool operator ==(Quaternion left, Quaternion right)
    Parameters
    Type Name Description
    Quaternion left

    The first value to compare.

    Quaternion right

    The second value to compare.

    Returns
    Type Description
    Boolean

    true if left has the same value as right; otherwise, false.

    | Improve this Doc View Source

    Inequality(Quaternion, Quaternion)

    Tests for inequality between two objects.

    Declaration
    public static bool operator !=(Quaternion left, Quaternion right)
    Parameters
    Type Name Description
    Quaternion left

    The first value to compare.

    Quaternion right

    The second value to compare.

    Returns
    Type Description
    Boolean

    true if left has a different value than right; otherwise, false.

    | Improve this Doc View Source

    Multiply(Quaternion, Quaternion)

    Multiplies a quaternion by another.

    Declaration
    public static Quaternion operator *(Quaternion left, Quaternion right)
    Parameters
    Type Name Description
    Quaternion left

    The first quaternion to multiply.

    Quaternion right

    The second quaternion to multiply.

    Returns
    Type Description
    Quaternion

    The multiplied quaternion.

    | Improve this Doc View Source

    Multiply(Quaternion, Vector3)

    Rotates the point with rotation.

    Declaration
    public static Vector3 operator *(Quaternion rotation, Vector3 point)
    Parameters
    Type Name Description
    Quaternion rotation

    The quaternion to rotate the vector.

    Vector3 point

    The vector to be rotated.

    Returns
    Type Description
    Vector3

    The vector after rotation.

    | Improve this Doc View Source

    Multiply(Quaternion, Single)

    Scales a quaternion by the given value.

    Declaration
    public static Quaternion operator *(Quaternion quaternion, float scale)
    Parameters
    Type Name Description
    Quaternion quaternion

    The quaternion to scale.

    Single scale

    The amount by which to scale the quaternion.

    Returns
    Type Description
    Quaternion

    The scaled quaternion.

    | Improve this Doc View Source

    Multiply(Single, Quaternion)

    Scales a quaternion by the given value.

    Declaration
    public static Quaternion operator *(float scale, Quaternion quaternion)
    Parameters
    Type Name Description
    Single scale

    The amount by which to scale the quaternion.

    Quaternion quaternion

    The quaternion to scale.

    Returns
    Type Description
    Quaternion

    The scaled quaternion.

    | Improve this Doc View Source

    Subtraction(Quaternion, Quaternion)

    Subtracts two quaternions.

    Declaration
    public static Quaternion operator -(Quaternion left, Quaternion right)
    Parameters
    Type Name Description
    Quaternion left

    The first quaternion to subtract.

    Quaternion right

    The second quaternion to subtract.

    Returns
    Type Description
    Quaternion

    The difference of the two quaternions.

    | Improve this Doc View Source

    UnaryNegation(Quaternion)

    Reverses the direction of a given quaternion.

    Declaration
    public static Quaternion operator -(Quaternion quaternion)
    Parameters
    Type Name Description
    Quaternion quaternion

    The quaternion to negate.

    Returns
    Type Description
    Quaternion

    A quaternion facing in the opposite direction.

    Implements

    System.IEquatable<T>
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX