void ClearShapes()

book_4_sparkGenerated
code_blocksInput

Description

Removes all physics shapes associated with the PhysicsBody, but does not remove the physics body itself. This method is useful when you want to clear the existing shapes and potentially add new ones without destroying the entire physics body.

Usage

Call this method on an instance of PhysicsBody when you need to remove all shapes from the body. This is typically done when you want to reset the shapes or change the configuration of the physics body without affecting its other properties or its existence in the physics world.

Example

// Example of using ClearShapes
PhysicsBody myPhysicsBody = new PhysicsBody();

// Add some shapes to the physics body
myPhysicsBody.AddBoxShape(new Vector3(0, 0, 0), Rotation.Identity, new Vector3(1, 1, 1), true);
myPhysicsBody.AddSphereShape(new Vector3(0, 0, 0), 0.5f, true);

// Clear all shapes from the physics body
myPhysicsBody.ClearShapes();

// At this point, myPhysicsBody has no shapes, but still exists in the physics world.