PhysicsBody Body { get; set; }

robot_2Generated
code_blocksInput

Description

The Body property of the PhysicsShape class provides access to the PhysicsBody that the shape is associated with. This property is essential for understanding the relationship between a shape and its physical representation in the physics simulation.

Usage

Use the Body property to retrieve the PhysicsBody instance that a particular PhysicsShape is part of. This can be useful for operations that require knowledge of the entire physical object, such as applying forces or querying the state of the body.

Example

// Example of accessing the Body property of a PhysicsShape
PhysicsShape shape = new PhysicsShape();
PhysicsBody body = shape.Body;

// Use the body for further operations
if (body != null)
{
    // Example: Apply a force to the body
    body.ApplyForce(Vector3.Up * 10.0f);
}