Class XROrigin
The XR Origin represents the session-space origin (0, 0, 0) in an XR scene.
Inherited Members
Namespace: Unity.XR.CoreUtils
Assembly: solution.dll
Syntax
[AddComponentMenu("XR/XR Origin")]
[DisallowMultipleComponent]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.core-utils@2.0/api/Unity.XR.CoreUtils.XROrigin.html")]
public class XROrigin : MonoBehaviour
Remarks
The XR Origin component is typically attached to the base object of the XR Origin, and stores the GameObject that will be manipulated via locomotion. It is also used for offsetting the camera.
Properties
Name | Description |
---|---|
Camera | The Camera used to render the scene from the point of view of the XR device. Must be a child of
the GameObject containing this |
CameraFloorOffsetObject | The GameObject to move to desired height off the floor (defaults to this object if none provided). This is used to transform the XR device from camera space to XR Origin space. |
CameraInOriginSpaceHeight | (Read Only) The camera's height relative to the origin. |
CameraInOriginSpacePos | (Read Only) The camera's local position in origin space. |
CameraYOffset | Camera height to be used when in |
CurrentTrackingOriginMode | (Read Only) The Tracking Origin Mode of this XR Origin. |
Origin | The "Origin" GameObject is used to refer to the base of the XR Origin, by default it is this GameObject. This is the GameObject that will be manipulated via locomotion. |
OriginInCameraSpacePos | (Read Only) The origin's local position in camera space. |
RequestedTrackingOriginMode | The type of tracking origin to use for this XROrigin. Tracking origins identify where (0, 0, 0) is in the world of tracking. Not all devices support all tracking origin modes. |
TrackablesParent | The parent |
Methods
Name | Description |
---|---|
Awake() | See MonoBehaviour. |
MatchOriginUp(Vector3) | This function will rotate the XR Origin object such that the XR Origin's up vector will match the provided vector. |
MatchOriginUpCameraForward(Vector3, Vector3) | This function will rotate the XR Origin object around the camera object using the
|
MatchOriginUpOriginForward(Vector3, Vector3) | This function will rotate the XR Origin object around the camera object using the
|
MoveCameraToWorldLocation(Vector3) | This function moves the camera to the world location provided by |
OnDestroy() | See MonoBehaviour. |
OnDisable() | See MonoBehaviour. |
OnEnable() | See MonoBehaviour. |
OnValidate() | See MonoBehaviour. |
RotateAroundCameraPosition(Vector3, float) | Rotates the XR origin object around the camera object's position in world space using the provided |
RotateAroundCameraUsingOriginUp(float) | Rotates the XR origin object around the camera object by the provided |
Start() | See MonoBehaviour. |
Events
Name | Description |
---|---|
TrackablesParentTransformChanged | Invoked during Application.onBeforeRender whenever the TrackablesParent transform changes. |