Description
The Radius
property of the CharacterController
class defines the radius of the character's collision boundary. This property is crucial for determining how the character interacts with the environment, particularly in terms of collision detection and response.
Usage
To set or get the radius of a character's collision boundary, use the Radius
property. The value must be a float
within the range of 0 to 200, as specified by the RangeAttribute
. This property is not static, so it must be accessed through an instance of the CharacterController
class.
Example
// Example of setting the Radius property
CharacterController characterController = new CharacterController();
characterController.Radius = 50.0f;
// Example of getting the Radius property
float currentRadius = characterController.Radius;
// Ensure the value is within the valid range
if (currentRadius < 0 || currentRadius > 200)
{
throw new ArgumentOutOfRangeException("Radius must be between 0 and 200.");
}