void Punch( Vector3& amount )

robot_2Generated
code_blocksInput

Description

The Punch method in the CharacterController class is used to disconnect the character from the ground and apply a sudden change to its velocity. This can be particularly useful for implementing actions such as jumping or other sudden movements.

Usage

To use the Punch method, you need to pass a reference to a Vector3 that represents the amount of velocity change you want to apply. The method will modify this vector to reflect the new velocity of the character.

Example

// Example of using the Punch method
CharacterController characterController = new CharacterController();
Vector3 punchAmount = new Vector3(0, 10, 0); // Example vector to apply upward force
characterController.Punch(ref punchAmount);

// After calling Punch, the character's velocity will be modified by the punchAmount vector.