Class XRMovableBody
Container for an Unity.XR.CoreUtils.XROrigin that can be transformed using the user's body as a frame of reference.
Inherited Members
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
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
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
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
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
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
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
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()
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()