Game Development Reference
In-Depth Information
Rigidbody Properties
Let's take a closer look at the Rigidbody component and its properties displayed in the Inspector
(Figure 6-1 ).
Figure 6-1. Rigidbody component in the Inspector
In physics, mass describes the amount of physical matter in an object. This is not the same as
weight—weight is the measurement of the pull of gravity on an object. For example, a golf ball
on Earth and a golf ball on the Moon have the same mass, but a different weight because of the
difference in gravity on the Earth and the Moon.
If you play around with the Mass property right now by changing the mass to 100 and playing, or to
0.1 and playing, the cube appears to fall at the same rate. Gravity is a constant force acting on an
object. Without getting into the mathematics, the acceleration (the speeding up) by gravity of two
objects with different masses will be the same, if you eliminate other factors such as air resistance.
In real terms, this means that a penny will fall at the same rate as a bowling ball. Mass is an
important factor in collisions and the application of arbitrary forces.
Drag is an opposing force that works like air resistance. Try changing the value of the Drag property
to 10, play, and see the effect it has on the falling cube.
Angular Drag works much the same way as Drag only in opposition to a rotational movement.
Uncheck Use Gravity and the cube no longer falls since it is no longer affected by gravity.
There may be situations within your game where you may want to move the game object with its
Transform rather than with the physics engine. Enabling Is Kinematic means the game object has a
Rigidbody component but is no longer driven by the physics engine.
Interpolate is used for smoothing the motion of an object. A general rule of thumb for optimizing
performance is not to use this unless you actually see jerkiness in the movement of your game
object. The Interpolate option smooths the motion based on the object's Transform in the previous
frame, while the Extrapolate option smooths the motion based on the object's estimated Transform
in the next frame.
Collision Detection varies the method the physics engine uses to calculate collisions. Discrete is
the default value for normal collisions. Continuous is used for fast-moving objects if their collisions
are not being detected properly. Game performance can be detrimentally affected when using
Continuous collision detection, so use this only if needed. Continuous Dynamic is a combination
 
Search WWH ::




Custom Search