Page 1 of 1

### mass?

Posted: Tue Sep 06, 2011 3:47 am
What should I set mass as for objects? Would it be a bad idea to have everything have the same mass? Should I do like width*height or pi*radius^2? I'm confused

### Re: mass?

Posted: Tue Sep 06, 2011 3:58 am
It depends how "weighty" you want your objects feeling. Mass has an effect on how much force you have apply to get the object moving, and on how much force it takes to stop it moving. It really depends on what you're trying to do. But I wouldn't recommend doing something like width * height, that would be VERY heavy (a kilogram per pixel).

### Re: mass?

Posted: Tue Sep 06, 2011 4:06 am
I don't really care how much each object weighs, as long as it falls the same speed and moves the same speed

### Re: mass?

Posted: Tue Sep 06, 2011 4:23 am
Why would you need to set a mass? Does love.physics require that?

### Re: mass?

Posted: Tue Sep 06, 2011 4:29 am
T-Bone wrote:Why would you need to set a mass? Does love.physics require that?
It does. And if you set the mass to 0 then it doesn't fall.

I'm a simple person, I like anchored or unanchored better

### Re: mass?

Posted: Tue Sep 06, 2011 5:45 am
miloguy wrote:I don't really care how much each object weighs, as long as it falls the same speed and moves the same speed
Well, you'll have to experiment with what mass you want each object as. How about something like 20-40? I highly doubt you want a tiny ball to fall like 20 cars glued together.
miloguy wrote:And if you set the mass to 0 then it doesn't fall.
Yeah, 0 mass makes the object static.

### Re: mass?

Posted: Tue Sep 06, 2011 6:16 am
miloguy wrote:And if you set the mass to 0 then it doesn't fall.
That actually makes sense when you think about it: how much force would you need to apply to move a body with a mass of 0? (the equation is Force = Mass * Acceleration)
I don't really care how much each object weighs, as long as it falls the same speed
Box2D works with mass in KG.
The speed at which an object falls is not affected by its mass (although you can slow down falling objects using linear damping - kinda like a dumbed down version of air resistance).
and moves the same speed
It depends on how you move the bodies. If you use SetLinearVelocity then the mass is irrelevant. If you use ApplyForce or ApplyImpulse it is. Keep in mind that a super massive object with a velocity of 10 m/s will produce different collision responses than a less massive object moving at the same speed.

### Re: mass?

Posted: Tue Sep 06, 2011 8:01 am
miloguy wrote:What should I set mass as for objects? Would it be a bad idea to have everything have the same mass? Should I do like width*height or pi*radius^2? I'm confused
There's also: http://love2d.org/wiki/Body:setMassFromShapes
However you would need to specify a density for your shapes before using this function in KG/meter^2.

### Re: mass?

Posted: Tue Sep 06, 2011 8:13 am
Body:setMassFromShapes is highly recommended, yes, because it automatically uses the most natural mass for the body. Don't forget to call it after you added the shapes, or it won't work.