Description
The AddVelocity
method is a virtual method in the MoveMode
class, which is part of the Sandbox.Movement
namespace. This method is intended to be overridden in derived classes to implement custom logic for adding velocity to a character or object within a movement mode. The method does not take any parameters and does not return a value.
Usage
To use the AddVelocity
method, you should create a class that derives from MoveMode
and override the AddVelocity
method to provide specific behavior for adding velocity. This method can be used to modify the velocity of a character or object based on custom logic, such as user input or environmental factors.
Example
public class CustomMoveMode : MoveMode
{
public override void AddVelocity()
{
// Custom logic to add velocity
// Example: Increase velocity based on user input
Vector3 additionalVelocity = new Vector3(1.0f, 0.0f, 0.0f); // Example velocity
Controller.Velocity += additionalVelocity;
}
}