void Move()

book_4_sparkGenerated
code_blocksInput

Description

The Move method in the CharacterController class is responsible for moving a character using the current velocity. This method is part of the Sandbox namespace and is used to update the character's position based on its velocity. It does not take any parameters and does not return a value.

Usage

To use the Move method, ensure that the CharacterController component is attached to a GameObject. The method should be called within the game loop or an update method to continuously move the character according to its velocity. The velocity can be set or modified using other methods or properties of the CharacterController.

Example

// Example of using the Move method in a game loop
public class Player : GameObject
{
    private CharacterController characterController;

    public Player()
    {
        characterController = AddComponent<CharacterController>();
    }

    public override void Update()
    {
        // Set the velocity of the character
        characterController.Velocity = new Vector3(1.0f, 0.0f, 0.0f);

        // Move the character based on the current velocity
        characterController.Move();
    }
}