If a Shape was restricted to not be shared between many bodies, a few things would get better, with the obvious cost of memory.
It would make the API more clean: the Shape could host its own body-local position and angle.
Keeping track of shape overlaps for collision events would be much simpler.
An alternative is to have a Fixture class to make the Shape classes clearly separated from bodies and physics. This could make it possible to use the Shape classes, intersection algorithms and raycasting without having to make a full rigid body simulation.
Perhaps the Fixture could be a class that extends each Shape.
If a
Shape
was restricted to not be shared between many bodies, a few things would get better, with the obvious cost of memory.Shape
could host its own body-local position and angle.An alternative is to have a Fixture class to make the
Shape
classes clearly separated from bodies and physics. This could make it possible to use the Shape classes, intersection algorithms and raycasting without having to make a full rigid body simulation. Perhaps theFixture
could be a class that extends eachShape
.