Struct XrQuaternionf
Represents a quaternion in OpenXR coordinates.
Implements
Inherited Members
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 |
Remarks
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 |
Returns
Type | Description |
---|---|
bool |
|
Overrides
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 |
|
FromSessionSpaceCoordinates(float, float, float, float)
Construct an instance from the given session-space coordinates. This method applies no transformations to the input values.
Declaration
public static XrQuaternionf FromSessionSpaceCoordinates(float x, float y, float z, float w)
Parameters
Type | Name | Description |
---|---|---|
float | x | The x-coordinate in session space. |
float | y | The y-coordinate in session space. |
float | z | The z-coordinate in session space. |
float | w | The w-coordinate in session space. |
Returns
Type | Description |
---|---|
XrQuaternionf | The instance. |
FromSessionSpaceCoordinates(Quaternion)
Construct an instance from the given session-space coordinates. This method applies no transformations to the input values.
Declaration
public static XrQuaternionf FromSessionSpaceCoordinates(Quaternion quaternion)
Parameters
Type | Name | Description |
---|---|---|
Quaternion | quaternion | The quaternion in session space. |
Returns
Type | Description |
---|---|
XrQuaternionf | The instance. |
GetHashCode()
Generates a unique hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | The hash code. |
Overrides
ToSessionSpaceQuaternion()
Convert this instance to a Unity Quaternion
. This method applies no transformation to
X, Y, Z, or W.
Declaration
public Quaternion ToSessionSpaceQuaternion()
Returns
Type | Description |
---|---|
Quaternion | The |