does anyone know how to set the mass of a fixture in jbox2d? the only way i found is to set the density, and the engine sets the mass based on density and area. how can i just set the mass if i already know it?
Thanks!
I think if I subclass polygon shape and override set mass I can do it that way, but how do I figure out mass data.I and the centroid?
No!
Use [icode]Body#setMassData(massData);[/icode], and then use a [icode]new MassData()[/icode] and set it’s [icode]massData.mass[/icode] value. But mind, that you also need to know the center of mass.
I suggest simply using density
The problem is that the mass of my entities is not related to their area.
I’ll probably copy the area code and put it in a getarea() function then divide the ass by area to set density.