Closed paulmartel closed 5 years ago
I think the only thing that is missing here is an ability to add shapes at certain positions and with certain rotations. This is already in the code, it is just not exposed in the api.
I think there is a room for performance improvement. Right now, the positions and rotations of shapes are stored in a separate dictionary of each body. We could apply these transformations on the shapes directly. This means that plane would need to store its normal and position, and a sphere would need to store its position. For convex, it's just transforming each vertex, normal and edge
The downside of this is that we would need to transform the meshes separately. But as the initial data is known, it should be possible to make a single mesh containing all shapes of a body. This would reduce the number of expensive draw calls in WebGL and improve the rendering performance.
This could also result in API simplification, there would be no need to deal with ShapeId
.
This was addressed in #43 by compound bodies:
https://github.com/w0rm/elm-physics/blob/master/examples/Compound.elm
Can be seen live here: https://unsoundscapes.com/elm-physics/examples/compound/
Allow support for concave bodies composed of individually transformed ConvexPolyhedron shapes. Support for constructing arbitrary tetrahedron shapes would also help here, providing universal building blocks for constructing arbitrary concave polyhedron bodies.
This would allow testing equivalences such as between a body consisting of a single cube shape with side length N and a body composed of NxNxN offset unit cubes with the same total mass uniformly apportioned.