Class ClimbProvider
Locomotion provider that allows the user to climb a ClimbInteractable by selecting it. Climb locomotion moves the XR Origin counter to movement of the last selecting interactor, with optional movement constraints along each axis of the interactable.
Implements
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit.Locomotion.Climbing
Assembly: Unity.XR.Interaction.Toolkit.dll
Syntax
[AddComponentMenu("XR/Locomotion/Climb Provider", 11)]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.2/api/UnityEngine.XR.Interaction.Toolkit.Locomotion.Climbing.ClimbProvider.html")]
[MovedFrom("UnityEngine.XR.Interaction.Toolkit")]
public class ClimbProvider : LocomotionProvider, IGravityController
Properties
canProcess
Whether the gravity can be processed. Gravity controllers that can process receive queries to gravityPaused, controllers that cannot process do not.
Declaration
public bool canProcess { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
It's recommended to return isActiveAndEnabled when implementing this interface in a MonoBehaviour.
See Also
climbAnchorInteractable
The interactable that is currently grabbed and driving movement. This will be null if there is no active climb.
Declaration
public ClimbInteractable climbAnchorInteractable { get; }
Property Value
Type | Description |
---|---|
ClimbInteractable |
See Also
climbAnchorInteractor
The interactor that is currently grabbing and driving movement. This will be null if there is no active climb.
Declaration
public IXRSelectInteractor climbAnchorInteractor { get; }
Property Value
Type | Description |
---|---|
IXRSelectInteractor |
See Also
climbSettings
Climb locomotion settings. Can be overridden by the ClimbInteractable used for locomotion.
Declaration
public ClimbSettingsDatumProperty climbSettings { get; set; }
Property Value
Type | Description |
---|---|
ClimbSettingsDatumProperty |
See Also
enableGravityOnClimbEnd
Whether to allow falling when climb locomotion ends. Disable to pause gravity when releasing, keeping the user from falling.
Declaration
public bool enableGravityOnClimbEnd { get; set; }
Property Value
Type | Description |
---|---|
bool |
See Also
gravityPaused
Whether gravity is paused.
Declaration
public bool gravityPaused { get; protected set; }
Property Value
Type | Description |
---|---|
bool |
See Also
providersToDisable
List of providers to disable while climb locomotion is active. If empty, no providers will be disabled by this component while climbing.
Declaration
public List<LocomotionProvider> providersToDisable { get; set; }
Property Value
Type | Description |
---|---|
List<LocomotionProvider> |
See Also
transformation
The transformation that is used by this component to apply climb movement.
Declaration
public XROriginMovement transformation { get; set; }
Property Value
Type | Description |
---|---|
XROriginMovement |
See Also
Methods
Awake()
See MonoBehaviour.
Declaration
protected override void Awake()
Overrides
See Also
FinishClimbGrab(IXRSelectInteractor)
Finishes the grab driven by interactor
. If this was the most recent grab then movement
will now be driven by the next most recent grab.
Declaration
public void FinishClimbGrab(IXRSelectInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
IXRSelectInteractor | interactor | The interactor whose grab to finish. |
Remarks
If there is no other active grab to fall back on, this will put the locomotionPhase in the Done state in the next Update().
See Also
OnGravityLockChanged(GravityOverride)
Called from TryLockGravity(IGravityController, GravityOverride) when gravity lock is changed.
Declaration
protected virtual void OnGravityLockChanged(GravityOverride gravityOverride)
Parameters
Type | Name | Description |
---|---|---|
GravityOverride | gravityOverride | The GravityOverride to apply. |
See Also
OnGroundedChanged(bool)
Called from GravityProvider when the grounded state changes.
Declaration
protected virtual void OnGroundedChanged(bool isGrounded)
Parameters
Type | Name | Description |
---|---|---|
bool | isGrounded | Whether the player is on the ground. |
Remarks
This is used to prevent players teleporting to the ground while climbing resulting in gravity failing to unpause.
See Also
RemoveGravityLock()
Removes this provider from the GravityProvider list's of locked providers.
Declaration
public void RemoveGravityLock()
See Also
StartClimbGrab(ClimbInteractable, IXRSelectInteractor)
Starts a grab as part of climbing climbInteractable
, using the position of
interactor
to drive movement.
Declaration
public void StartClimbGrab(ClimbInteractable climbInteractable, IXRSelectInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
ClimbInteractable | climbInteractable | The object to climb. |
IXRSelectInteractor | interactor | The interactor that initiates the grab and drives movement. |
Remarks
This puts the locomotionPhase in the Started state if locomotion has not already started. The phase will then enter the Moving state in the next Update().
See Also
TryLockGravity(GravityOverride)
Attempts to lock gravity.
Declaration
public bool TryLockGravity(GravityOverride gravityOverride)
Parameters
Type | Name | Description |
---|---|---|
GravityOverride | gravityOverride | The GravityOverride to apply. |
Returns
Type | Description |
---|---|
bool | Whether the gravity was successfully locked. |
See Also
Update()
See MonoBehaviour.
Declaration
protected virtual void Update()
See Also
Events
climbAnchorUpdated
Calls the methods in its invocation list when the provider updates climbAnchorInteractable and climbAnchorInteractor. This can be invoked from either StartClimbGrab(ClimbInteractable, IXRSelectInteractor) or FinishClimbGrab(IXRSelectInteractor). This is not invoked when climb locomotion ends.
Declaration
public event Action<ClimbProvider> climbAnchorUpdated
Event Type
Type | Description |
---|---|
Action<ClimbProvider> |