Mass

Mass is stored as a floating-point value under a Rigidbody component's mass property, and documentation on its usage has changed a fair amount over the years due to updates in its physics engine. Since late Unity 5, we are essentially free to choose whatever we want the 1.0 value to represent and then scale other
values appropriately.

Traditionally, a mass value of 1.0 is used to represent a mass of 1 kilogram, but we could decide that a human being has a mass of 1.0 (~80 kilograms), in which case, a car would be given a mass value of 15.0 (~1,200 kilograms), and physics collisions will resolve similarly to what we expect. The most important part is the relative difference in mass, which allows collisions between these objects to look believable without stressing the engine too much. Floating-point precision is also a concern, so we don't want to use large mass values that are too ridiculous.

Note that if we intend to use Wheel Colliders, their design assumes that a mass of 1.0 represents 1 kilogram, so we should assign our mass values appropriately.

Ideally, we would maintain mass values around 1.0 and ensure a maximum relative mass-ratio of around 100. If two objects collide with a mass ratio much higher than this, then large momentum differences can turn into sudden, immense velocity changes from the impulse, resulting in some unstable physics and potential loss of floating-point precision. Object pairs that have a significant scale difference should probably be culled with the Collision Matrix to avoid problems (more on this shortly).

Improper mass ratios are the most common cause of physics instability and erratic behavior in Unity. This is particularly true when using joints for objects such as ragdolls.

Note that the force of gravity at the center of the Earth affects all objects equally, regardless of their mass, so it does not matter if we consider a mass property value of 1.0 to be the mass of a rubber ball or the mass of a warship. There's no need to adjust the force of gravity to compensate. What does matter, however, is the amount of air resistance the given object undergoes while falling (which is why a parachute falls slowly). So, to maintain realistic behavior, we may need to customize the drag property for such objects or customize the force of gravity on a per-object basis. For example, we could disable the Use Gravity checkbox and apply our custom gravitational force during fixed updates.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.59.231