The GroundObject
property of the PlayerController
class represents the GameObject
that the player is currently standing on. If the player is not standing on any object, this property will be null
.
The GroundObject
property of the PlayerController
class represents the GameObject
that the player is currently standing on. If the player is not standing on any object, this property will be null
.
Use the GroundObject
property to determine what object the player is currently standing on. This can be useful for implementing game mechanics that depend on the type of surface the player is interacting with, such as different movement speeds or sound effects.
// Example of using GroundObject PlayerController playerController = new PlayerController(); // Check if the player is standing on an object if (playerController.GroundObject != null) { // Get the name of the object the player is standing on string groundObjectName = playerController.GroundObject.Name; // Output the name of the ground object // (Assuming a method to display or log the name) DisplayGroundObjectName(groundObjectName); } else { // Player is not standing on any object DisplayGroundObjectName("No ground object"); }