Class JumpProvider
Jump Provider allows the player to jump in the scene.
This uses a jump force to drive the value of the jump
Implements
Inherited Members
Namespace: UnityEngine .XR.Interaction.Toolkit.Locomotion.Jump
Assembly: Unity.XR.Interaction.Toolkit.dll
Syntax
[AddComponentMenu("XR/Locomotion/Jump Provider", 11)]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.1/api/UnityEngine.XR.Interaction.Toolkit.Locomotion.Jump.JumpProvider.html")]
public class JumpProvider : LocomotionProvider, IGravityController
Properties
canProcess
Whether the gravity can be processed.
Gravity controllers that can process receive queries to gravity
Declaration
public bool canProcess { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
It's recommended to return is
disableGravityDuringJump
Disable gravity during the jump. This will result in a more floaty jump.
Declaration
public bool disableGravityDuringJump { get; set; }
Property Value
Type | Description |
---|---|
bool |
earlyOutDecelerationSpeed
The speed at which the jump will decelerate when the player releases the jump button early.
Declaration
public float earlyOutDecelerationSpeed { get; set; }
Property Value
Type | Description |
---|---|
float |
gravityPaused
Whether gravity is paused.
Declaration
public bool gravityPaused { get; protected set; }
Property Value
Type | Description |
---|---|
bool |
See Also
inAirJumpCount
The number of times a player can jump before landing.
Declaration
public int inAirJumpCount { get; set; }
Property Value
Type | Description |
---|---|
int |
isJumping
Returns whether the player is currently jumping.
Declaration
public bool isJumping { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
jumpForgivenessWindow
The time window after leaving the ground that a jump can still be performed. Sometimes known as coyote time.
Declaration
public float jumpForgivenessWindow { get; set; }
Property Value
Type | Description |
---|---|
float |
jumpHeight
The height (approximately in meters) the player will be when reaching the apex of the jump.
Declaration
public float jumpHeight { get; set; }
Property Value
Type | Description |
---|---|
float |
jumpInput
Input data that will be used to perform a jump.
If the source is an Input Action, it must have a button-like interaction where phase equals performed when pressed.
Typically a Button
Declaration
public XRInputButtonReader jumpInput { get; set; }
Property Value
Type | Description |
---|---|
XRInput |
maxJumpHoldTime
The maximum time a player can hold down the jump button to increase altitude.
Declaration
public float maxJumpHoldTime { get; set; }
Property Value
Type | Description |
---|---|
float |
minJumpHoldTime
The minimum amount of time the jump will execute for.
Declaration
public float minJumpHoldTime { get; set; }
Property Value
Type | Description |
---|---|
float |
transformation
The transformation that is used by this component to apply translation movement.
Declaration
public XROriginMovement transformation { get; set; }
Property Value
Type | Description |
---|---|
XROrigin |
unlimitedInAirJumps
Allow player to jump without being grounded.
Declaration
public bool unlimitedInAirJumps { get; set; }
Property Value
Type | Description |
---|---|
bool |
variableHeightJump
Whether the jump height is based on how long the player continues to hold the jump button. Enable to allow the player to stop their jump early when input is released before reaching the maximum jump height. Disable to jump a fixed height.
Declaration
public bool variableHeightJump { get; set; }
Property Value
Type | Description |
---|---|
bool |
Methods
Awake()
See Mono
Declaration
protected override void Awake()
Overrides
CanJump()
Determines if the player can jump.
Declaration
public bool CanJump()
Returns
Type | Description |
---|---|
bool | Returns whether the player can jump. The Jump() method will not do anything while this method returns false. |
Remarks
Returns true when any of these conditions are met:
- The player is grounded or within the jump forgiveness time (coyote time).
- The player has remaining in-air jumps.
See Also
IsPausingGravity()
Whether this Jump
Declaration
public bool IsPausingGravity()
Returns
Type | Description |
---|---|
bool | Returns true if is |
Jump()
Initiates the jump routine.
Declaration
public void Jump()
See Also
OnDisable()
See Mono
Declaration
protected virtual void OnDisable()
OnEnable()
See Mono
Declaration
protected virtual void OnEnable()
OnGravityLockChanged(GravityOverride)
Called from Try
Declaration
protected virtual void OnGravityLockChanged(GravityOverride gravityOverride)
Parameters
Type | Name | Description |
---|---|---|
Gravity |
gravityOverride | The Gravity |
See Also
OnGroundedChanged(bool)
Called from Gravity
Declaration
protected virtual void OnGroundedChanged(bool isGrounded)
Parameters
Type | Name | Description |
---|---|---|
bool | isGrounded | Whether the player is on the ground. |
See Also
OnValidate()
See Mono
Declaration
protected virtual void OnValidate()
RemoveGravityLock()
Removes this provider from the Gravity
Declaration
public void RemoveGravityLock()
TryLockGravity(GravityOverride)
Attempts to lock gravity.
Declaration
public bool TryLockGravity(GravityOverride gravityOverride)
Parameters
Type | Name | Description |
---|---|---|
Gravity |
gravityOverride | The Gravity |
Returns
Type | Description |
---|---|
bool | Whether the gravity was successfully locked. |
Update()
See Mono
Declaration
protected virtual void Update()