IEnumerable<PhysicsShape> Shapes { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The Shapes property of the PhysicsBody class provides access to all the PhysicsShape instances that are associated with this particular physics body. Each PhysicsShape defines a part of the physical representation of the body, contributing to its collision and physical interactions within the physics simulation.

Usage

Use the Shapes property to iterate over all the shapes that make up a PhysicsBody. This can be useful for inspecting or modifying the properties of individual shapes, such as their material or collision settings.

Example

// Example of iterating over all shapes in a PhysicsBody
PhysicsBody body = new PhysicsBody();
foreach (PhysicsShape shape in body.Shapes)
{
    // Perform operations on each shape
    Console.WriteLine(shape.ToString());
}