Class LocomotionProvider
Base for a behavior that implements a specific type of user locomotion. This behavior communicates with a
Locomotion
Inherited Members
Namespace: UnityEngine .XR.Interaction.Toolkit.Locomotion
Assembly: Unity.XR.Interaction.Toolkit.dll
Syntax
[DefaultExecutionOrder(-210)]
[MovedFrom("UnityEngine.XR.Interaction.Toolkit")]
public abstract class LocomotionProvider : MonoBehaviour
Properties
canStartMoving
Whether the provider has finished preparing for locomotion and is ready to enter the Moving state.
This only applies when locomotion
Declaration
public virtual bool canStartMoving { get; }
Property Value
Type | Description |
---|---|
bool |
isLocomotionActive
Whether the provider is actively preparing or performing locomotion. This is true when
locomotion
Declaration
public bool isLocomotionActive { get; }
Property Value
Type | Description |
---|---|
bool |
See Also
locomotionState
The current state of locomotion. The mediator determines this state based on the provider's
requests for the XRBody
Declaration
public LocomotionState locomotionState { get; }
Property Value
Type | Description |
---|---|
Locomotion |
See Also
mediator
The behavior that this provider communicates with for access to the mediator's XRBody
Declaration
public LocomotionMediator mediator { get; set; }
Property Value
Type | Description |
---|---|
Locomotion |
transformationPriority
The queue order of this provider's transformations of the XR Origin. The lower the value, the earlier the transformations are applied.
Declaration
public int transformationPriority { get; set; }
Property Value
Type | Description |
---|---|
int |
See Also
Methods
Awake()
See Mono
Declaration
protected virtual void Awake()
OnLocomotionEnding()
Called when locomotion enters the Ended state, after the provider invokes
locomotion
Declaration
protected virtual void OnLocomotionEnding()
OnLocomotionStarting()
Called when locomotion enters the Moving state, after the provider gains
access to the XRBody
Declaration
protected virtual void OnLocomotionStarting()
TryEndLocomotion()
Attempts to transition this provider into the Ended state. This succeeds if
is
Declaration
protected bool TryEndLocomotion()
Returns
Type | Description |
---|---|
bool | Returns true if is |
Remarks
After this provider enters the Ended state, it will invoke
locomotion
TryPrepareLocomotion()
Attempts to transition this provider into the Preparing state. This succeeds
if is
Declaration
protected bool TryPrepareLocomotion()
Returns
Type | Description |
---|---|
bool | Returns true if is |
Remarks
If this succeeds, then the provider can enter the Moving state either by calling
Try
TryQueueTransformation(IXRBodyTransformation)
Attempts to queue a transformation to be applied during the active XRBody
Declaration
protected bool TryQueueTransformation(IXRBodyTransformation bodyTransformation)
Parameters
Type | Name | Description |
---|---|---|
IXRBody |
bodyTransformation | The transformation that will receive a call to
Apply(XRMovable |
Returns
Type | Description |
---|---|
bool | Returns true if the provider has access to the XRBody |
Remarks
This should only be called when locomotion
See Also
TryQueueTransformation(IXRBodyTransformation, int)
Attempts to queue a transformation to be applied during the active XRBodypriority
determines when the
transformation is applied in relation to others. The queue attempt only succeeds if the provider is in the
Moving state.
Declaration
protected bool TryQueueTransformation(IXRBodyTransformation bodyTransformation, int priority)
Parameters
Type | Name | Description |
---|---|---|
IXRBody |
bodyTransformation | The transformation that will receive a call to
Apply(XRMovable |
int | priority | Value that determines when to apply the transformation. Transformations with lower priority values are applied before those with higher priority values. |
Returns
Type | Description |
---|---|
bool | Returns true if the provider has access to the XRBody |
Remarks
This should only be called when locomotion
See Also
TryStartLocomotionImmediately()
Attempts to transition this provider into the Moving state. This succeeds if
locomotion
Declaration
protected bool TryStartLocomotionImmediately()
Returns
Type | Description |
---|---|
bool | Returns true if locomotion |
Remarks
This method bypasses the check for can
Events
beforeStepLocomotion
Calls the methods in its invocation list just before the XRBody
Declaration
public event Action<LocomotionProvider> beforeStepLocomotion
Event Type
Type | Description |
---|---|
Action<Locomotion |
Remarks
This is invoked before the XRBody
locomotionEnded
Calls the methods in its invocation list when the provider has entered the Ended state.
Declaration
public event Action<LocomotionProvider> locomotionEnded
Event Type
Type | Description |
---|---|
Action<Locomotion |
See Also
locomotionStarted
Calls the methods in its invocation list when the provider has entered the Moving state.
Declaration
public event Action<LocomotionProvider> locomotionStarted
Event Type
Type | Description |
---|---|
Action<Locomotion |