IEnumerable<PhysicsBody> Bodies { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The Bodies property of the PhysicsGroup class provides access to all the physics bodies that are part of this physics group. This property returns an IEnumerable<PhysicsBody>, allowing you to iterate over each PhysicsBody within the group.

Usage

Use the Bodies property when you need to perform operations on each physics body within a PhysicsGroup. This can be useful for applying transformations, forces, or other physics-related operations to all bodies in the group.

Example

// Example of iterating over all physics bodies in a PhysicsGroup
PhysicsGroup physicsGroup = new PhysicsGroup();

foreach (PhysicsBody body in physicsGroup.Bodies)
{
    // Perform operations on each body
    body.ApplyForce(new Vector3(0, 0, 10));
}