Class CharacterControllerBodyManipulator
Scriptable object that can perform constrained movement of an XRMovableBody by using a CharacterController that follows the user's body. Each time this object is about to call Move on the characterController, it first ensures that the center and height are set such that the bottom of the capsule matches the position determined by GetBodyGroundLocalPosition() and the height of the capsule matches Unity.XR.CoreUtils.XROrigin.CameraInOriginSpaceHeight.
Inheritance
Implements
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit.Locomotion
Assembly: Unity.XR.Interaction.Toolkit.dll
Syntax
[CreateAssetMenu(fileName = "CharacterControllerBodyManipulator", menuName = "XR/Locomotion/Character Controller Body Manipulator")]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.0/api/UnityEngine.XR.Interaction.Toolkit.Locomotion.CharacterControllerBodyManipulator.html")]
public class CharacterControllerBodyManipulator : ScriptableConstrainedBodyManipulator, IConstrainedXRBodyManipulator
Properties
characterController
The character controller attached to the originTransform of the linkedBody. This is null if linkedBody is null.
Declaration
public CharacterController characterController { get; }
Property Value
Type | Description |
---|---|
CharacterController |
isGrounded
Whether the linkedBody is touching the ground, as of the most recent call to MoveBody(Vector3).
Declaration
public override bool isGrounded { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
lastCollisionFlags
Flags indicating the direction of the collision from the most recent call to MoveBody(Vector3).
Declaration
public override CollisionFlags lastCollisionFlags { get; }
Property Value
Type | Description |
---|---|
CollisionFlags |
Overrides
Methods
MoveBody(Vector3)
Applies the given motion to linkedBody. A collision can constrain the movement from taking place.
Declaration
public override CollisionFlags MoveBody(Vector3 motion)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | motion | Amount of translation to apply. |
Returns
Type | Description |
---|---|
CollisionFlags | Returns flags that indicate the direction of the collision, if there was one. |
Overrides
OnLinkedToBody(XRMovableBody)
Called after the given body links this manipulator to it. The implementation should ensure that
linkedBody points to body
after this method is called.
Declaration
public override void OnLinkedToBody(XRMovableBody body)
Parameters
Type | Name | Description |
---|---|---|
XRMovableBody | body | The body linked with this manipulator. |
Overrides
See Also
OnUnlinkedFromBody()
Called when a body unlinks this manipulator from it. The implementation should ensure that linkedBody returns null after this method is called.
Declaration
public override void OnUnlinkedFromBody()