Yeah. I was thinking about backward compatability. Perhaps setDefaultMass should stay in addGeom. An overloaded version could be addGeom(..., boolean setMass);
But even so, this method would still be a bit crappy because it would ignore GeomTransforms and a more expected behavior from a users point of view would be that the mass should be altered and not set. The ideal logic would use the low level mass functions for creating a mass for the underlying geom, translating that mass, and then adding the mass to the current mass parameters. Its one of those things that is probably 4 lines of code but quite hard to tell if its actually working or not so maybe this issue should be ignored.
As for the dMass reference in the constructor I see:
1 2 3 4
| public Body(String name, World world, PlaceableGeom geom) { .... dMass mass = new dMass(); massId = mass.getCPtr(); |
I am saying the mass object should be declared not as a local variable but as a field of Body, to avoid garbage collection.