The GroundAngle
property of the CharacterController
class specifies the maximum angle of the ground that the character can walk on. This property is crucial for determining the character's ability to traverse slopes and uneven terrain.
The GroundAngle
property of the CharacterController
class specifies the maximum angle of the ground that the character can walk on. This property is crucial for determining the character's ability to traverse slopes and uneven terrain.
Use the GroundAngle
property to set or get the maximum slope angle that the character can walk on. The value is a float
and should be between 0
and 90
degrees, where 0
represents a flat surface and 90
represents a vertical wall.
// Example of setting the GroundAngle property CharacterController characterController = new CharacterController(); characterController.GroundAngle = 45.0f; // Allow the character to walk on slopes up to 45 degrees // Example of getting the GroundAngle property float currentGroundAngle = characterController.GroundAngle; Console.WriteLine($"Current Ground Angle: {currentGroundAngle}");