Description
The Body
property of the PlayerController
class provides access to the Rigidbody
component associated with the player. This component is crucial for handling the physics interactions of the player character within the game world, such as movement, collisions, and forces.
Usage
To access the Body
property, you need to have an instance of the PlayerController
class. This property is read-only and is automatically managed by the PlayerController
to ensure that the player's physics are correctly simulated.
Example
// Assuming 'playerController' is an instance of PlayerController
Rigidbody playerBody = playerController.Body;
// You can now use 'playerBody' to interact with the player's Rigidbody
// For example, applying a force to the player
playerBody.ApplyForce(new Vector3(0, 10, 0));