Is Rigidbody mass its "mass" or "weight"?

Discussion in 'Physics' started by alexisrabadan, Nov 6, 2015.

Joined:
Aug 26, 2014
Posts:
74
I just had a quick look and I couldn't find any exact info, so I just need to know does Rigidbody mass variable simulate its weight or mass (where of course weight is mass * gravity). This link http://docs.unity3d.com/ScriptReference/Rigidbody-mass.html states that you should never set the mass higher than 10 , but the car in the standard assets demo is set to a mass of 1000 (which makes it sound like a weight figure).

My thoughts are that you should just set object masses relevant to each other, but what happens when you want something really light (ie. tennis ball) and something heavy (ie. truck) to collide (where if the truck was set to 10, then we would need the ball at .00002 (based on a collision between 5 tonnes and 100 grams)?

2. The Rigidbody mass variable simulates the mass of an object, not weight. Weight is a force and changes, and will vary while mass will (for our purposes) always remain the same.

The car in your example - on earth - has a mass of 1000 (mass units), and a weight of 9810 (force units). If the unit of mass is kilograms, the weight would be 9810 newtons.

As for objects with large differences in mass, there are a few possible approaches you can take. Remember the .1 - 10 scale is a recommendation, not an absolute.

If 99% of the objects in your game are going to be cars or trucks, you may want to set the mass of the truck to 10 (units) and the mass of the tennis ball to .00002 (units). Or, the other way around if 99% of your objects are going to have the mass of tennis balls.

Another option would be to use realistic units. It's easier for testing and conceptually - set the mass of the truck to 10000 (1 unit = 1 kg) and the mass of the tennis ball to .02 units. This lets you just think of real masses when you set things rather than having to convert in your head. This maintains your relationships without going to some exceptionally large numbers for mass. If one of the numbers is getting to large or small, you can shift by an order of magnitude (i.e. 1000 units for the truck, .002 units for the tennis ball) to balance them out.

The last option - which would probably be fine in most cases - is to forget about making the numbers realistic, and just make the behavior feel realistic. You aren't making an accurate physics sim, you are making a game. If there's a difference of six orders of magnitude in mass between two objects, then it probably will feel fine with a difference of only three orders of magnitude. (100 units for the truck, .2 units for the ball). If you need to, tweak the drag and physics materials a bit until you find something that 'feels' right.

Unity Technologies

Joined:
May 24, 2013
Posts:
1,960
Mass is mass i.e. how much 'stuff' is in it.

Weight is a force in Newtons that relates to the mass but presents itself under the force of gravity. If you increase the force of gravity, its weight increases.

Its weight (N) is the product of its mass (M) and gravity.magnitude.

The default gravity in Unity is (0,-9.81). That means a body with a mass of 1Kg will have a weight of 9.81 N. Set gravity to zero and this 1Kg mass will have zero weight i.e. exert zero force.

I think however you're referring to momentum which is the energy an object carries. If you apply a force to a body of a certain mass, it gains momentum. A body with higher mass will take more force to increase/decrease momentum. Likewise, a body with smaller mass takes less force to increase/decrease momentum.

Forces which affect its momentum include forces using when things collide. Therefore, a large truck of 1000Kg is harder to affect than a tennis ball of 0.1Kg.

Joined:
Aug 26, 2014
Posts:
74
Thanks zagdrob, I agree with your last option. It would be better to stick to the recommendations of the physics engine and create objects that feel good, rather than try and simulate prefectly realistic values

5. Using real mass values is fine, if you're doing a realistic simulation you really ought to. The trouble with computational physics isn't really the sizes of the masses, it's the ratio of masses between objects. I.e., if you have 2 objects stacked on each other or constrained to each other by a joint or something, you shouldn't get any more problems with both masses being 10000 than you would if they were 1. But if one object has mass of 1 and the other has 10000, you're bound to get instabilities.

I use real masses here:

This is perfectly safe to do in this situation because there is only one rigid body: The boat. If it had to run over tiny little boxes that had barely any mass compared to the boat, those little boxes could be expected to explode and not react very well, especially if they got sandwiched between the boat and a landmass or something.

So whether you can get away with real masses or not depends on what you're doing. Unless you're doing an arcade type game (Flappy Bird doesn't need to weigh the same as a real bird), I'd tend to start with real masses and then revise it if you're getting stability problems.