Class XROrigin | XR Core Utilities | 2.3.0
docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class XROrigin

    The XR Origin represents the session-space origin (0, 0, 0) in an XR scene.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    XROrigin
    Inherited Members
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(string, float)
    MonoBehaviour.InvokeRepeating(string, float, float)
    MonoBehaviour.CancelInvoke(string)
    MonoBehaviour.IsInvoking(string)
    MonoBehaviour.StartCoroutine(string)
    MonoBehaviour.StartCoroutine(string, object)
    MonoBehaviour.StartCoroutine(IEnumerator)
    MonoBehaviour.StartCoroutine_Auto(IEnumerator)
    MonoBehaviour.StopCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(Coroutine)
    MonoBehaviour.StopCoroutine(string)
    MonoBehaviour.StopAllCoroutines()
    MonoBehaviour.print(object)
    MonoBehaviour.useGUILayout
    MonoBehaviour.runInEditMode
    Behaviour.enabled
    Behaviour.isActiveAndEnabled
    Component.GetComponent(Type)
    Component.GetComponent()
    Component.TryGetComponent(Type, out Component)
    Component.TryGetComponent(out T)
    Component.GetComponent(string)
    Component.GetComponentInChildren(Type, bool)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren(bool)
    Component.GetComponentInChildren()
    Component.GetComponentsInChildren(Type, bool)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren(bool)
    Component.GetComponentsInChildren(bool, List)
    Component.GetComponentsInChildren()
    Component.GetComponentsInChildren(List)
    Component.GetComponentInParent(Type)
    Component.GetComponentInParent()
    Component.GetComponentsInParent(Type, bool)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent(bool)
    Component.GetComponentsInParent(bool, List)
    Component.GetComponentsInParent()
    Component.GetComponents(Type)
    Component.GetComponents(Type, List)
    Component.GetComponents(List)
    Component.GetComponents()
    Component.CompareTag(string)
    Component.SendMessageUpwards(string, object, SendMessageOptions)
    Component.SendMessageUpwards(string, object)
    Component.SendMessageUpwards(string)
    Component.SendMessageUpwards(string, SendMessageOptions)
    Component.SendMessage(string, object)
    Component.SendMessage(string)
    Component.SendMessage(string, object, SendMessageOptions)
    Component.SendMessage(string, SendMessageOptions)
    Component.BroadcastMessage(string, object, SendMessageOptions)
    Component.BroadcastMessage(string, object)
    Component.BroadcastMessage(string)
    Component.BroadcastMessage(string, SendMessageOptions)
    Component.transform
    Component.gameObject
    Component.tag
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(object)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, bool)
    Object.Instantiate(T)
    Object.Instantiate(T, Vector3, Quaternion)
    Object.Instantiate(T, Vector3, Quaternion, Transform)
    Object.Instantiate(T, Transform)
    Object.Instantiate(T, Transform, bool)
    Object.Destroy(Object, float)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, bool)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, float)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType()
    Object.FindObjectOfType()
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.ToString()
    Object.name
    Object.hideFlags
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetType()
    object.MemberwiseClone()
    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 XROrigin component.

    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 Device Tracking Origin Mode to define the height of the user from the floor. This is the amount that the camera is offset from the floor when moving the CameraFloorOffsetObject.

    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 Transform for all "trackables" (for example, planes and feature points).

    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 destinationUp vector such that:

    • The camera will look at the area in the direction of the destinationForward
    • The projection of camera's forward vector on the plane with the normal destinationUp will be in the direction of destinationForward
    • The up vector of the XR Origin object will match the provided destinationUp vector (note that the camera's Up vector can not be manipulated)
    MatchOriginUpOriginForward(Vector3, Vector3)

    This function will rotate the XR Origin object around the camera object using the destinationUp vector such that:

    • The forward vector of the XR Origin object, which is the direction the player moves in Unity when walking forward in the physical world, will match the provided destinationUp vector
    • The up vector of the XR Origin object will match the provided destinationUp vector
    MoveCameraToWorldLocation(Vector3)

    This function moves the camera to the world location provided by desiredWorldLocation. It does this by moving the XR Origin object so that the camera's world location matches the desiredWorldLocation

    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 vector as the rotation axis. The XR Origin object is rotated by the amount of degrees provided in angleDegrees.

    RotateAroundCameraUsingOriginUp(float)

    Rotates the XR origin object around the camera object by the provided angleDegrees. This rotation only occurs around the origin's Up vector

    Start()

    See MonoBehaviour.

    Events

    Name Description
    TrackablesParentTransformChanged

    Invoked during Application.onBeforeRender whenever the TrackablesParent transform changes.

    Extension Methods

    MonoBehaviourExtensions.StartRunInEditMode(MonoBehaviour)
    MonoBehaviourExtensions.StopRunInEditMode(MonoBehaviour)
    In This Article
    Back to top
    Copyright © 2024 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)