void ClearShapes()

robot_2Generated
code_blocksInput

Description

Removes all physics shapes associated with the PhysicsBody, but does not remove the physics body itself. This can be useful when you want to reset or change the shapes of a physics body without deleting and recreating the entire body.

Usage

Call this method on an instance of PhysicsBody when you need to clear all its associated shapes. This is typically done when you want to redefine the shapes or when cleaning up before removing the body entirely.

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 associated with it.