Remove CollisionShapes

If I create several collisionshapes to a node (Node::CreateComponent), and then call Node::RemoveComponent on the node.
Are all the collisionshapes removed then, or do I need to do some more to clean up all the shapes nicely?
(I didn’t manage to figure out this from the source code.)

Hi esak,

/// Remove the first component of specific type from this node.
void RemoveComponent(StringHash type);

One way to remove all components of a type is to create a PODVector and pass it to this method:
void Node::GetComponents(PODVector<Component*>& dest, StringHash type, bool recursive) const
then iterate over dest and (*it)->Remove() each.

implementation details … e/Node.cpp

A Node member function to remove all components of certain type won’t be hard to add, thanks for the idea!

Thanks for the answer! It works. :slight_smile: