Description
The Accelerate
method is used to add acceleration to the current velocity of a character. This method is part of the CharacterController
class, which allows for collision-constrained movement without the need for a rigidbody. The acceleration is applied directly to the velocity, and there is no need to manually scale it by the time delta, as this is handled internally by the method.
Usage
To use the Accelerate
method, you need to have an instance of the CharacterController
class. You can then call the method with a Vector3
parameter that represents the acceleration vector you wish to apply to the character's velocity.
Example
// Create a new CharacterController instance
CharacterController characterController = new CharacterController();
// Define an acceleration vector
Vector3 accelerationVector = new Vector3(1.0f, 0.0f, 0.0f);
// Apply acceleration to the character
characterController.Accelerate(accelerationVector);