docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class XRMovableBody

    Container for an Unity.XR.CoreUtils.XROrigin that can be transformed using the user's body as a frame of reference.

    Inheritance
    object
    XRMovableBody
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.XR.Interaction.Toolkit.Locomotion
    Assembly: Unity.XR.Interaction.Toolkit.dll
    Syntax
    public class XRMovableBody

    Constructors

    XRMovableBody(XROrigin, IXRBodyPositionEvaluator)

    Initializes a new instance of a movable body.

    Declaration
    public XRMovableBody(XROrigin xrOrigin, IXRBodyPositionEvaluator bodyPositionEvaluator)
    Parameters
    Type Name Description
    XROrigin xrOrigin

    The XR Origin associated with the body.

    IXRBodyPositionEvaluator bodyPositionEvaluator

    The object that determines the position of the user's body.

    See Also
    IXRBodyTransformation

    Properties

    bodyPositionEvaluator

    The object that determines the position of the user's body.

    Declaration
    public IXRBodyPositionEvaluator bodyPositionEvaluator { get; }
    Property Value
    Type Description
    IXRBodyPositionEvaluator
    See Also
    IXRBodyTransformation

    constrainedManipulator

    Object that can be used to perform movement that is constrained by collision (optional, may be null).

    Declaration
    public IConstrainedXRBodyManipulator constrainedManipulator { get; }
    Property Value
    Type Description
    IConstrainedXRBodyManipulator
    See Also
    IXRBodyTransformation

    originTransform

    The Transform component of the Unity.XR.CoreUtils.XROrigin.Origin of the xrOrigin. This is the Transform component that is manipulated to move the body.

    Declaration
    public Transform originTransform { get; }
    Property Value
    Type Description
    Transform
    See Also
    IXRBodyTransformation

    xrOrigin

    The XR Origin whose Unity.XR.CoreUtils.XROrigin.Origin is transformed to move the body.

    Declaration
    public XROrigin xrOrigin { get; }
    Property Value
    Type Description
    XROrigin
    See Also
    IXRBodyTransformation

    Methods

    GetBodyGroundLocalPosition()

    Gets the position of where the user's body is grounded (e.g. their feet), in the local space of the originTransform, based on the bodyPositionEvaluator.

    Declaration
    public Vector3 GetBodyGroundLocalPosition()
    Returns
    Type Description
    Vector3

    Returns the position of where the user's body is grounded, in the local space of the originTransform.

    See Also
    IXRBodyTransformation

    GetBodyGroundWorldPosition()

    Gets the world position of where the user's body is grounded (e.g. their feet), based on the bodyPositionEvaluator.

    Declaration
    public Vector3 GetBodyGroundWorldPosition()
    Returns
    Type Description
    Vector3

    Returns the world position of where the user's body is grounded.

    See Also
    IXRBodyTransformation

    LinkConstrainedManipulator(IConstrainedXRBodyManipulator)

    Links the given constrained manipulator to this body. This sets constrainedManipulator to manipulator and calls OnLinkedToBody(XRMovableBody) on the manipulator.

    Declaration
    public void LinkConstrainedManipulator(IConstrainedXRBodyManipulator manipulator)
    Parameters
    Type Name Description
    IConstrainedXRBodyManipulator manipulator

    The constrained manipulator to link.

    Remarks

    If constrainedManipulator is already not null when this is called, this first calls OnUnlinkedFromBody() on constrainedManipulator. Also, if the given manipulator already has a linkedBody set, this calls UnlinkConstrainedManipulator() on that body.

    See Also
    UnlinkConstrainedManipulator()

    UnlinkConstrainedManipulator()

    Unlinks the assigned constrained manipulator from this body, if there is one. This calls OnUnlinkedFromBody() on the manipulator and sets constrainedManipulator to null.

    Declaration
    public void UnlinkConstrainedManipulator()
    See Also
    LinkConstrainedManipulator(IConstrainedXRBodyManipulator)

    See Also

    IXRBodyTransformation
    In This Article
    Back to top
    Copyright © 2025 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)