int ShapeCount { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The ShapeCount property of the PhysicsBody class indicates the number of shapes that are associated with this physics body. Each PhysicsBody can have multiple shapes, and this property provides a count of those shapes.

Usage

Use the ShapeCount property to determine how many shapes are currently part of a PhysicsBody. This can be useful for debugging, optimization, or when you need to perform operations based on the number of shapes.

Example

// Example of accessing the ShapeCount property
PhysicsBody myPhysicsBody = new PhysicsBody();
int numberOfShapes = myPhysicsBody.ShapeCount;

// Output the number of shapes
// Note: Avoid using Console.WriteLine in Sandbox
// Instead, use a logging system or in-game UI to display the information
Log.Info($"Number of shapes in the physics body: {numberOfShapes}");