The GroundComponent
property of the PlayerController
class represents the collider component that the player is currently standing on. If the player is not standing on any surface, this property will be null
.
The GroundComponent
property of the PlayerController
class represents the collider component that the player is currently standing on. If the player is not standing on any surface, this property will be null
.
Use the GroundComponent
property to determine the specific collider component beneath the player. This can be useful for implementing logic that depends on the type of surface the player is interacting with, such as different movement behaviors or sound effects.
// Example of using GroundComponent // Assuming 'playerController' is an instance of PlayerController Component groundCollider = playerController.GroundComponent; if (groundCollider != null) { // Perform actions based on the ground collider Console.WriteLine("Player is standing on: " + groundCollider.Name); } else { Console.WriteLine("Player is not standing on any surface."); }