how does box2d calculate mass?
here is my world :
Code: Select all
Meter = 64
love.physics.setMeter(Meter)
--World = love.physics.newWorld(0, 0, true)
World = love.physics.newWorld(0, 9.81 * Meter, true)
then i create a shape :
Code: Select all
Width = Meter/2
Height = Meter * 2
local shape = love.physics.newRectangleShape(Width, Height)
local fixture = love.physics.newFixture(myBody, shape, Density)
d = mass / volume
so i did this :
Code: Select all
Density = 60 / (Width * Height) * Meter -- (to scale back up?)
so i run this, it builds my rectangle guy, and Density prints at : 0.9375
but when I check the mass of my newly created shape, it returns : 0.9375 using myBody:getMass()
but using : shape:computerMass(Density) returns "60"
Code: Select all
print("compute mass : ", shape:computeMass(Density))
print("getMass : ", myBody:getMass())
am i missing something here? shouldnt the mass of the body reflect the computeMass() or does box2d not actually calculate this ?compute mass : 60
getMass : 0, 0, 0.9385, 1360 (x,y, mass, inertia)