Erin,
It appears you've removed GetDensity from the fixtures. I realize you're doing all the mass stuff as soon as the fixture gets created now, but I still need access to the density info (get and set). Can you add that back in? Or where did you move it to?
Thanks 🙂
I could add density back in at a cost of memory and without any use inside the engine. Why not store that in the user data?
Well I could keep a copy of it sure, that's not really a problem, but then I still can't update it after the body has been created... is it really that costly to have a SetDensity function?
Is this for an editor where you are trying to change the density in real-time? For an editor you should not be using Box2D as your database, because Box2D is not designed to be a client database and it will probably never be designed to be a client database.
The reason is that Box2D needs to cook some data to be efficient. It also loses some data during the cooking process so you cannot recover the original data.
We have the ability to make something static or revert back to dynamic using b2World::SetMassData and b2World::ResetMass. In principle, you can set the mass properties to anything you want. You can view the fixture definition as the easy way to set the mass properties.
Do you actually have a case where you need to change the density from one positive value to another positive value at run-time? If so, please file a change request at Google and provide a code sample of how you need this to work.