Description
The GroupIndex
property of the PhysicsBody
class returns the index of this physics body within its associated PhysicsGroup
. This index can be used to identify the position of the body within the group, which is useful for managing and organizing multiple physics bodies that are part of the same group.
Usage
To access the GroupIndex
property, you need to have an instance of a PhysicsBody
. You can then simply get the property value to determine the body's index within its group.
Example
// Assuming 'physicsBody' is an instance of PhysicsBody
int index = physicsBody.GroupIndex;
// Output the index
// Note: Avoid using Console.WriteLine in Sandbox
// Use the index for further logic or debugging