PhysicsShape AddCloneShape( PhysicsShape shape )

robot_2Generated
code_blocksInput

Description

The AddCloneShape method is used to add a clone of an existing PhysicsShape to a PhysicsBody. This method is useful when you want to duplicate a shape and attach it to the same or another physics body without modifying the original shape.

Usage

To use the AddCloneShape method, you need to have an instance of PhysicsBody and a PhysicsShape that you want to clone. Call the method on the PhysicsBody instance, passing the PhysicsShape as a parameter. The method returns a new PhysicsShape that is a clone of the provided shape.

Example

// Assuming 'body' is an instance of PhysicsBody and 'shape' is an existing PhysicsShape
PhysicsShape clonedShape = body.AddCloneShape(shape);

// The clonedShape is now a part of the 'body' and can be manipulated independently.