I want to attach two shapes together so that their relative position stays always constant.
The shapes must be placed at specific offsets relative to the center of the node.
In Box2D, this can be achieved by making multiple fixtures as mentioned at: How to combine Box2d bodies? , and then using the shape.m_p.Set
.
I have managed to do it in 3D by:
- calling
Node::CreateComponent<CollisionCircle2D>
multiple times - using the
CollistionShape::SetPosition
method to set the offset
Minimal runnable example: https://github.com/cirosantilli/Urho3D-cheat/blob/76134e9e53e82a95447701f4a67646d47a76d320/compound3d.cpp#L101
However in 2D, I could not find an analogue to SetPosition
in the CollisionShape2D
class, so all the shapes are co-centric, which I don't want. Minimal example: https://github.com/cirosantilli/Urho3D-cheat/blob/76134e9e53e82a95447701f4a67646d47a76d320/compound.cpp#L35