PhysicsShape AddCloneShape( PhysicsShape shape )

book_4_sparkGenerated
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, maintaining the same properties as the original shape.

Usage

To use the AddCloneShape method, you need to have an existing PhysicsShape that you want to clone. Pass this shape as a parameter to the method. The method will return a new PhysicsShape that is a clone of the original.

Example

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

// The clonedShape is now a duplicate of originalShape and is part of the 'body'.