Description
The StepHeight
property of the CharacterController
class defines the maximum height that the character can step over. This property is useful for controlling how the character navigates over small obstacles, such as curbs or steps, without requiring a jump.
Usage
To use the StepHeight
property, simply set it to a value between 0 and 50, which represents the maximum height in units that the character can step over. This property is typically adjusted based on the scale of your game world and the desired movement behavior of the character.
For example, if you want the character to be able to step over obstacles that are up to 0.5 units high, you would set StepHeight
to 0.5.
Example
// Example of setting the StepHeight property
CharacterController characterController = new CharacterController();
characterController.StepHeight = 0.5f; // Allows stepping over obstacles up to 0.5 units high