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 actions such as jumping or other sudden movements where the character needs to be propelled in a specific direction.

Usage

To use the Punch method, you need to pass a reference to a Vector3 that represents the amount and direction of the 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, 5, 0); // This will apply an upward force
characterController.Punch(ref punchAmount);