PhysicsBody GetBody( int groupIndex )
PhysicsBody GetBody( string groupName )

robot_2Generated
code_blocksInput

Description

The GetBody method retrieves a PhysicsBody from the PhysicsGroup based on the specified groupIndex. This method is useful for accessing individual physics bodies within a group, such as when you need to apply specific transformations or retrieve properties from a particular body.

Usage

To use the GetBody method, you need to have an instance of PhysicsGroup. Call the method with the desired groupIndex to obtain the corresponding PhysicsBody. Ensure that the groupIndex is within the valid range of the group's bodies.

Example

// Assuming 'physicsGroup' is an instance of PhysicsGroup
int index = 0; // Index of the body you want to retrieve
PhysicsBody body = physicsGroup.GetBody(index);

// Now you can perform operations on the retrieved PhysicsBody
Vector3 position = body.Position;
body.ApplyForce(new Vector3(0, 0, 10));