docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct XrQuaternionf

    Represents a quaternion in OpenXR coordinates.

    Implements
    IEquatable<XrQuaternionf>
    Inherited Members
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.XR.OpenXR.NativeTypes
    Assembly: Unity.XR.OpenXR.dll
    Syntax
    public struct XrQuaternionf : IEquatable<XrQuaternionf>

    Constructors

    XrQuaternionf(float, float, float, float)

    Construct an instance from the given Unity coordinates.

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

    The x coordinate from Unity's coordinate system.

    float y

    The y coordinate from Unity's coordinate system.

    float z

    The z coordinate from Unity's coordinate system.

    float w

    The w coordinate from Unity's coordinate system.

    Remarks
    Important

    This constructor negates the x and y values to convert from Unity's left-handed coordinate system to the right-handed system used by OpenXR.

    XrQuaternionf(Quaternion)

    Construct an instance from the given Unity quaternion.

    Declaration
    public XrQuaternionf(Quaternion quaternion)
    Parameters
    Type Name Description
    Quaternion quaternion

    The quaternion, in Unity coordinates.

    Remarks
    Important

    This constructor negates the x and y values of the input quaternion to convert from Unity's left-handed coordinate system to the right-handed system used by OpenXR.

    Fields

    W

    The w coordinate of the quaternion, in OpenXR coordinates.

    Declaration
    public float W
    Field Value
    Type Description
    float

    X

    The x coordinate of the quaternion, in OpenXR coordinates.

    Declaration
    public float X
    Field Value
    Type Description
    float

    Y

    The y coordinate of the quaternion, in OpenXR coordinates.

    Declaration
    public float Y
    Field Value
    Type Description
    float

    Z

    The z coordinate of the quaternion, in OpenXR coordinates.

    Declaration
    public float Z
    Field Value
    Type Description
    float

    Methods

    AsQuaternion()

    Convert this instance in OpenXR coordinates to a Quaternion in Unity coordinates.

    Declaration
    public Quaternion AsQuaternion()
    Returns
    Type Description
    Quaternion

    The output Quaternion.

    Remarks
    Important

    This method negates the X and Y values to convert from OpenXR's right-handed coordinate system to the left-handed system used by Unity.

    Equals(object)

    Compares for equality. Two instances are equal if their bits are exactly identical for the X, Y, Z, and W fields.

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

    The other object.

    Returns
    Type Description
    bool

    true if obj is an XrQuaternionf and equal to this instance. Otherwise, false.

    Overrides
    ValueType.Equals(object)

    Equals(XrQuaternionf)

    Compares for equality. Two instances are equal if their bits are exactly identical for the X, Y, Z, and W fields.

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

    The other instance.

    Returns
    Type Description
    bool

    true if the instances are equal. Otherwise, false.

    GetHashCode()

    Generates a unique hash code for this instance.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    The hash code.

    Overrides
    ValueType.GetHashCode()

    Implements

    IEquatable<T>
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)