mass?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Re: mass?
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?
Why would you need to set a mass? Does love.physics require that?
My game called Hat Cat and the Obvious Crimes Against the Fundamental Laws of Physics is out now!
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Re: mass?
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:I don't really care how much each object weighs, as long as it falls the same speed and moves the same speed
Yeah, 0 mass makes the object static.miloguy wrote:And if you set the mass to 0 then it doesn't fall.
Re: mass?
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)miloguy wrote:And if you set the mass to 0 then it doesn't fall.
Box2D works with mass in KG.I don't really care how much each object weighs, as long as it falls the same speed
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).
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.and moves the same speed
Re: mass?
There's also: http://love2d.org/wiki/Body:setMassFromShapesmiloguy 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
However you would need to specify a density for your shapes before using this function in KG/meter^2.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: mass?
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.
Help us help you: attach a .love.
Who is online
Users browsing this forum: Google [Bot] and 3 guests