API reference
API reference
Select your platform
No SDKs available
No versions available

OVRExtensions Class

Miscellaneous extension methods that any script can use.
This class encapulsates several extension methods that help convert between the Quest's coordinate system and Unity's coorindate system. Use these methods to convert to and from the Quest's local tracking space and Unity's world space, for example.
This class also contains several methods to facilitate native interop, as the native plugin uses a different coordinate system than Unity (for example, OVRPlugin.Posef). These methods are used by the Meta XR Core SDK, but typically should not necessary in application code.

Static Member Functions

Converts the given world-space transform to an OVRPose in tracking space.
The "tracking space" refers to the local coordinate system of the Quest device. This method uses a camera's world-space transform to calculate the transform between the Quest's tracking space and Unity's world space, then applies it to the transform to compute that transform in the device's tracking space.
Parameters
transform
A transform that will be converted to a tracking space pose.
camera
The camera whose transform is driven by the HMD. This is often the main camera.
Returns
Returns the pose of the transform in tracking space.
Converts the given pose from tracking-space to world-space.
The "tracking space" refers to the local coordinate system of the Quest device. This method uses the main camera's world-space transform to calculate the transform between the Quest's tracking space and Unity's world space, then applies it to the trackingSpacePose to compute that pose in Unity world space. Deprecated
This method is obsolete. Use ToWorldSpacePose(OVRPose, Camera) instead.
Parameters
trackingSpacePose
The pose, in tracking-space, to convert to world space.
Returns
The trackingSpacePose in world space.
Converts the given pose from tracking-space to world-space.
The "tracking space" refers to the local coordinate system of the Quest device. This method uses mainCamera 's world-space transform to calculate the transform between the Quest's tracking space and Unity's world space, then applies it to the trackingSpacePose to compute that pose in Unity world space.This is the inverse operation of ToTrackingSpacePose.
Parameters
trackingSpacePose
The pose to convert to world-space.
mainCamera
The camera whose transform is driven by the HMD. This is often the main camera.
Returns
trackingSpacePose in world space.
Converts the given pose from tracking-space to head-space.
The "tracking space" refers to the local coordinate system of the Quest device. This method converts a pose in tracking space to a pose relative to the XRNode.Head.
Parameters
trackingSpacePose
The pose, in tracking space, that should be converted to head space.
Returns
trackingSpacePose in head space.
Converts the given world-space transform to an OVRPose in head space.
The "head space" refers to the local coordinate system of the Quest HMD. This method converts the given transform to an equivalent pose relative to the user's head.
Parameters
transform
The transform to convert to head space.
camera
The camera whose transform is driven by the Quest HMD. This is often the main camera.
Returns
transform converted to a head relative pose.
Converts the given transform to an OVRPose.
Parameters
t
The transform to convert to a pose.
isLocal
If true, uses the local position and transform of t . Otherwise, uses the world space position and rotation.
Returns
t as a OVRPose.
Sets a transform to the given OVRPose.
Parameters
t
The transform whose position and rotation will be set.
pose
The OVRPose to convert to t .
isLocal
If true, t 's local position and transform are set. Otherwise, sets the world position and rotation.
Converts an OVRPlugin.Posef to an OVRPose.
OVRPlugin.Posef is typically used for native interop with native plugins, and uses a different coordinate system (right-handed as opposed to Unity's left-handed coordinate system).This method converts the right-handed OVRPlugin.Posef to a left-handed OVRPose compatible with Unity's coordinate system.This method is for advanced usage.
Parameters
p
A right-handed pose acquired from a native function call.
Returns
p converted to an OVRPose.
Converts an OVRPlugin.Frustumf to an OVRTracker.Frustum.
OVRPlugin.Frustumf is typically used for native interop with native plugins. This method converts that native format into a format that is more compatible with Unity.This method is for advanced usage.
Parameters
f
The OVRPlugin.Frustumf to convert to OVRTracker.Frustum.
Returns
f converted to an OVRTracker.Frustum.
Converts a OVRPlugin.Colorf to a UnityEngine Color.
This method is used to convert color data between the native OVRPlugin.Colorf format and a UnityEngine Color.This method is for advanced usage and is not typically used by application code.
Parameters
c
A color in native color format.
Returns
c as a UnityEngine Color.
Converts a UnityEngine Color to a OVRPlugin.Colorf.
This method is used to convert color data between the native OVRPlugin.Colorf format and a UnityEngine Color.This method is for advanced usage and is not typically used by application code.
Parameters
c
A color in Unity's Color format.
Returns
c as a OVRPlugin.Colorf.
Converts a OVRPlugin.Sizef to a UnityEngine Vector2.
This method is used to convert size data between the native OVRPlugin.Sizef format and a UnityEngine Vector2.This method is for advanced usage and is not typically used by application code.
Parameters
v
A size in OVRPlugin's native format.
Returns
v as a UnityEngine Vector2.
Converts a Vector2 to a OVRPlugin.Sizef.
This method is used to convert size data between the native OVRPlugin.Sizef format and a UnityEngine Vector2.This method is for advanced usage and is not typically used by application code.
Parameters
v
A size as a Vector2.
Returns
v as an OVRPlugin compatible OVRPlugin.Sizef.
Converts a OVRPlugin.Vector2f to a UnityEngine Vector2.
This method is used to convert vector data between the native OVRPlugin.Vector2f format and a UnityEngine Vector2.This method is for advanced usage and is not typically used by application code.
Parameters
v
A vector in OVRPlugin's native format.
Returns
v as a UnityEngine Vector2.
Converts a OVRPlugin.Vector2f to a UnityEngine Vector2.
This method is used to convert vector data between the native OVRPlugin.Vector2f format and a UnityEngine Vector2.This method negates the X component of the OVRPlugin.Vector2f.This method is for advanced usage and is not typically used by application code.
Parameters
v
A vector in OVRPlugin's native format.
Returns
v as a UnityEngine Vector2.
Converts a Vector2 to a OVRPlugin.Vector2f.
This method is used to convert vector data between the native OVRPlugin.Vector2f format and a UnityEngine Vector2.This method is for advanced usage and is not typically used by application code.
Parameters
v
A UnityEngine Vector2.
Returns
v as a OVRPlugin.Vector2f.
Converts size information between the native plugin and Unity format.
This method is used to convert size data between the native OVRPlugin.Size3f format and a UnityEngine Vector3.This method is for advanced usage and is not typically used by application code.
Parameters
v
A size as a OVRPlugin.Size3f.
Returns
v as a UnityEngine Vector3.
Converts size information between the native plugin and Unity format.
This method is used to convert size data between the native OVRPlugin.Size3f format and a UnityEngine Vector3.This method is for advanced usage and is not typically used by application code.
Parameters
v
A size as a UnityEngine Vector3.
Returns
v as a OVRPlugin.Size3f.
Converts a 3d vector between the native plugin and Unity format.
This method is used to convert a 3d vector between the native OVRPlugin.Vector3f format and a UnityEngine Vector3.This method is for advanced usage and is not typically used by application code.
Parameters
v
A 3d vector as an OVRPlugin.Vector3f.
Returns
v as a UnityEngine Vector3.
Converts a 3d vector between the native plugin and Unity format.
This method is used to convert a 3d vector between the native OVRPlugin.Vector3f format and a UnityEngine Vector3.This method negates the X component of v .This method is for advanced usage and is not typically used by application code.
Parameters
v
A 3d vector as an OVRPlugin.Vector3f.
Returns
v as a UnityEngine Vector3.
Converts a 3d vector between the native plugin and Unity format.
This method is used to convert a 3d vector between the native OVRPlugin.Vector3f format and a UnityEngine Vector3.This method negates the Z component of v .This method is for advanced usage and is not typically used by application code.
Parameters
v
A 3d vector as an OVRPlugin.Vector3f.
Returns
v as a UnityEngine Vector3.
Converts a 3d vector between the native plugin and Unity format.
This method is used to convert a 3d vector between the native OVRPlugin.Vector3f format and a UnityEngine Vector3.This method is for advanced usage and is not typically used by application code.
Parameters
v
A 3d vector as UnityEngine Vector3.
Returns
v as an OVRPlugin.Vector3f.
See Also
Converts a 3d vector between the native plugin and Unity format.
This method is used to convert a 3d vector between the native OVRPlugin.Vector3f format and a UnityEngine Vector3.This method negates the X component of v .This method is for advanced usage and is not typically used by application code.
Parameters
v
A 3d vector as UnityEngine Vector3.
Returns
v as an OVRPlugin.Vector3f.
Converts a 3d vector between the native plugin and Unity format.
This method is used to convert a 3d vector between the native OVRPlugin.Vector3f format and a UnityEngine Vector3.This method negates the Z component of v .This method is for advanced usage and is not typically used by application code.
Parameters
v
A 3d vector as UnityEngine Vector3.
Returns
v as an OVRPlugin.Vector3f.
Converts a 4d vector between the native plugin and Unity format.
This method is used to convert a 4d vector between the native OVRPlugin.Vector4f format and a UnityEngine Vector4.This method is for advanced usage and is not typically used by application code.
Parameters
v
A 4d vector as an OVRPlugin.Vector4f.
Returns
v as a UnityEngine Vector4.
See Also
Converts a 4d vector between the native plugin and Unity format.
This method is used to convert a 4d vector between the native OVRPlugin.Vector4f format and a UnityEngine Vector4.This method is for advanced usage and is not typically used by application code.
Parameters
v
A 4d vector as UnityEngine Vector4.
Returns
v as an OVRPlugin.Vector4f.
See Also
Converts a quaternion between the native plugin and Unity format.
This method is used to convert a quaternion between the native OVRPlugin.Quatf format and a UnityEngine Quaternion.This method is for advanced usage and is not typically used by application code.
Parameters
q
A quaternion as an OVRPlugin.Quatf.
Returns
q as a UnityEngine Quaternion.
See Also
Converts a quaternion between the native plugin and Unity format.
This method is used to convert a quaternion between the native OVRPlugin.Quatf format and a UnityEngine Quaternion.This method negates the Y and Z components of the quaternion, which has the effect of flipping the rotation about the X axis.This method is for advanced usage and is not typically used by application code.
Parameters
q
A quaternion as an OVRPlugin.Quatf.
Returns
q as a UnityEngine Quaternion.
Converts a quaternion between the native plugin and Unity format.
This method is used to convert a quaternion between the native OVRPlugin.Quatf format and a UnityEngine Quaternion.This method negates the X and Y components of the quaternion, which has the effect of flipping the rotation about the Z axis.This method is for advanced usage and is not typically used by application code.
Parameters
q
A quaternion as an OVRPlugin.Quatf.
Returns
q as a UnityEngine Quaternion.
Converts a quaternion between the native plugin and Unity format.
This method is used to convert a quaternion between the native OVRPlugin.Quatf format and a UnityEngine Quaternion.This method is for advanced usage and is not typically used by application code.
Parameters
q
A quaternion as a UnityEngine Quaternion.
Returns
q as an OVRPlugin.Quatf.
See Also
Converts a quaternion between the native plugin and Unity format.
This method is used to convert a quaternion between the native OVRPlugin.Quatf format and a UnityEngine Quaternion.This method negates the Y and Z components of the quaternion, which has the effect of flipping the rotation about the X axis.This method is for advanced usage and is not typically used by application code.
Parameters
q
A quaternion as a UnityEngine Quaternion.
Returns
q as an OVRPlugin.Quatf.
Converts a quaternion between the native plugin and Unity format.
This method is used to convert a quaternion between the native OVRPlugin.Quatf format and a UnityEngine Quaternion.This method negates the X and Y components of the quaternion, which has the effect of flipping the rotation about the Z axis.This method is for advanced usage and is not typically used by application code.
Parameters
q
A quaternion as a UnityEngine Quaternion.
Returns
q as an OVRPlugin.Quatf.
Converts a matrix between the native plugin and Unity format.
This method is used to convert a matrix between the native OVR.OpenVR.HmdMatrix34_t format and a UnityEngine Matrix4x4.This method negates the Z axis of the rotation and translation, which converts between the native right-handed coordinate system and Unity's left-handed coordinate system.This method is for advanced usage and is not typically used by application code.
Parameters
m
The Matrix4x4 to convert.
Returns
Returns m as an OVR.OpenVR.HmdMatrix34_t.
Recursively searches for a child transform with the given name.
Note that only children of parent are considered. parent itself is not included in the search.A child transform is considered a match if any part of its name contains name .
Parameters
parent
The transform at which to begin the search.
name
The name of the transform to find.
Returns
Returns the first child of parent with name , or null, if no such child exists.
Compares two Gradients for equality.
Parameters
gradient
The Gradient to compare with otherGradient.
otherGradient
The Gradient to compare with gradient.
Returns
Returns true if gradient is equal to otherGradient .
Copies one gradiant into another.
Parameters
gradient
The Gradient that otherGradient will be copied into.
otherGradient
The Gradient to copy into gradient .
Did you find this page helpful?
Thumbs up icon
Thumbs down icon