The StepHeight
property of the CharacterController
class defines the maximum height that the character can step over. This property is useful for allowing characters to navigate over small obstacles without requiring a jump.
The StepHeight
property of the CharacterController
class defines the maximum height that the character can step over. This property is useful for allowing characters to navigate over small obstacles without requiring a jump.
To set the StepHeight
property, simply assign a float
value within the specified range. The range is defined by the RangeAttribute
as 0 to 50, with a step of 0.01. This means you can set the step height to any value between 0 and 50, inclusive, with increments of 0.01.
// Example of setting the StepHeight property CharacterController characterController = new CharacterController(); characterController.StepHeight = 0.5f; // Set the step height to 0.5 units // Ensure the value is within the valid range if (characterController.StepHeight < 0 || characterController.StepHeight > 50) { throw new ArgumentOutOfRangeException("StepHeight must be between 0 and 50."); }