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.)
Archive 17/01/2023.
Remove CollisionShapes
esak
jmiller
Hi esak,
Correct;
/// 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
github.com/urho3d/Urho3D/blob/m … e/Node.cpp
cadaver
A Node member function to remove all components of certain type won’t be hard to add, thanks for the idea!
esak
Thanks for the answer! It works.