Struct XrVector3f
Represents a three-dimensional vector in OpenXR coordinates.
Implements
Inherited Members
Namespace: UnityEngine.XR.OpenXR.NativeTypes
Assembly: Unity.XR.OpenXR.dll
Syntax
public struct XrVector3f : IEquatable<XrVector3f>
Constructors
XrVector3f(float, float, float)
Construct an instance from the given Unity coordinates relative to your XR Origin.
Declaration
public XrVector3f(float x, float y, float z)
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. |
Remarks
Important
This constructor negates the z
value to convert from Unity's left-handed coordinate
system to the right-handed system used by OpenXR.
XrVector3f(Vector3)
Construct an instance from the given Vector3
relative to your XR Origin.
Declaration
public XrVector3f(Vector3 value)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | value | The position from Unity's coordinate system. |
Remarks
Important
This constructor negates the z value of the input Vector3
to convert from Unity's left-handed coordinate
system to the right-handed system used by OpenXR.
Fields
X
The x-coordinate of the vector, in OpenXR coordinates.
Declaration
public float X
Field Value
Type | Description |
---|---|
float |
Y
The y-coordinate of the vector, in OpenXR coordinates.
Declaration
public float Y
Field Value
Type | Description |
---|---|
float |
Z
The z-coordinate of the vector, in OpenXR coordinates.
Declaration
public float Z
Field Value
Type | Description |
---|---|
float |
Methods
AsVector3()
Convert this instance in OpenXR coordinates to a Vector3
in Unity coordinates.
Declaration
public Vector3 AsVector3()
Returns
Type | Description |
---|---|
Vector3 | The output |
Remarks
Important
This method negates the Z value 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 identical for the X
, Y
, and Z
fields.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The other object. |
Returns
Type | Description |
---|---|
bool |
|
Overrides
Equals(XrVector3f)
Compares for equality.
Two instances are equal if their bits are identical for the X
, Y
, and Z
fields.
Declaration
public bool Equals(XrVector3f other)
Parameters
Type | Name | Description |
---|---|---|
XrVector3f | other | The other instance. |
Returns
Type | Description |
---|---|
bool |
|
FromSessionSpaceCoordinates(float, float, float)
Construct an instance from the given session-space coordinates. This method applies no transformations to the input values.
Declaration
public static XrVector3f FromSessionSpaceCoordinates(float x, float y, float z)
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. |
Returns
Type | Description |
---|---|
XrVector3f | The instance. |
FromSessionSpaceCoordinates(Vector3)
Construct an instance from the given session-space coordinates. This method applies no transformations to the input values.
Declaration
public static XrVector3f FromSessionSpaceCoordinates(Vector3 position)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | position | The position in session space. |
Returns
Type | Description |
---|---|
XrVector3f | The instance. |
GetHashCode()
Generates a unique hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | The hash code. |
Overrides
ToSessionSpaceVector3()
Declaration
public Vector3 ToSessionSpaceVector3()
Returns
Type | Description |
---|---|
Vector3 | The |