Skip to content

Player Force Base

eisclimber edited this page Apr 20, 2024 · 1 revision

Player Force Base

abstract class in ExPresSXR.Movement / Extends MonoBehavior

Description

A base class that can be used to apply a force on the player, while providing an solution for the use with teleportation movement.

Important: Derived classes must implement the movement itself by calling _characterController.Move() during Update() but only apply the force only _forceTemporarilyDisabled.
You should also not disable the components if you are planning on not applying the force for an unspecified duration as it might cause interference. Create a variable in your script instead. See PlayerGravity, PlayerRigidForce and ClimbingGravityManager for reference.

Members

Editor Properties

  • InputActionReference[] _inputActionPausingForce: InputActions that temporarily disable the force for the specified duration. You want to set it to the InputsActions used for teleportation.
  • float _forcePauseDuration: Duration for how long the force will be temporarily disabled. Default: 0.1f
  • CharacterController _characterController: CharacterController to be manipulated.

Protected Properties

  • bool _forceTemporarilyDisabled: Will be true if the force is temporarily disabled after a input action was performed. Do not apply the force in these cases to allow teleport movement.

Public Properties

  • Vector3 _currentVelocity;: (Readonly/Protected field) The current velocity applied.

Protected Methods

  • virtual void OnEnable(): Adds a callback that temporary pauses the force.
  • virtual void OnDisable(): Removes callback that temporary pause the force.
  • virtual void PauseForce(InputAction.CallbackContext _): Callback that pauses the the force for the specified time.
  • virtual IEnumerator PauseForceCoroutine(): Coroutine function that pauses the force temporarily.

Public Methods

  • void ClearVelocity(): Sets the current velocity to (0, 0, 0).

ExPresS XR Wiki

Tutorial Pages

Code Documentation

Clone this wiki locally