float Radius { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The Radius property of the CapsuleCollider class represents the radius of the capsule shape used in collision detection. This property is a float value that determines the thickness of the capsule's cylindrical part.

Usage

To use the Radius property, you can get or set its value to adjust the size of the capsule collider. This is useful for defining the collision boundaries of an object in a scene.

Example

// Example of setting the radius of a CapsuleCollider
CapsuleCollider capsuleCollider = new CapsuleCollider();
capsuleCollider.Radius = 1.5f;

// Example of getting the radius of a CapsuleCollider
float currentRadius = capsuleCollider.Radius;

// Output the current radius
// Note: Use a logging system instead of Console.WriteLine
Log.Info($"Current Capsule Radius: {currentRadius}");