CapsuleCollider BodyCollider { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The BodyCollider property of the PlayerController class provides access to the player's main physical collider, which is a CapsuleCollider. This collider is used to define the physical boundaries of the player character in the game world, allowing for collision detection and response with other objects and surfaces.

Usage

Use the BodyCollider property to access or modify the player's capsule collider. This can be useful for adjusting the player's collision boundaries, such as changing the size or position of the collider to fit different player models or gameplay scenarios.

Example

// Accessing the BodyCollider property
CapsuleCollider playerCollider = playerController.BodyCollider;

// Modifying the collider's height
playerCollider.Height = 2.0f;

// Adjusting the collider's radius
playerCollider.Radius = 0.5f;