So, I am trying to create a ball throwing game however I can’t work out how to change the mass.
I want to be able to specify a mass, and input the required density to do so. (lets say it’s a 10kg tennis ball, therefore density is…). To do this, I need the area!
[lua]
local ball = display.newCircle(playerhero.x, playerhero.y, 5)
physics.addBody(ball, “dynamic”, {density = 1, bounce=0.1, friction=1})
ball:setFillColor(0,1,0)
ball.alpha = 1
local ballarea = (math.pi*(5/30)^2) --note pi r ^2 the r is /30 to relate this back to metres due to the scale.
print(“ball area =”…ballarea)
print(“ball mass =”…ball.mass)
[/lua]
I thought the calc for mass was density*area (according to corona docs), but when I calc the area myself I get the following:
ball area =0.087266462599716
ball mass =0.11111111938953
As density is 1, I would expect these to be identical. I can’t manually change mass, so I was planning to calculate required density.
?I assume as the scale is metres and gravity is m.s^-2 that mass will be kg?