Dynamic objects are objects that can move and be affected by forces. For example, react to collisions with a game character or other moving objects, and follow the gravity.
The simplest example of a dynamic object is a ball. If a character hits a ball, the ball will move in response. Dynamic objects are perfect for balls and any other objects you expect to be movable in your game scene, such as barrels, crates, see-saw objects, etc.
To make an object dynamic, select an object in a scene in the Edit mode, go to the Physics tab in the Inspector panel, and turn the Physics on. Change the type of the Rigidbody to Dynamic.
In the example below, you can see the Physics tab with the settings for a dynamic ball object.
Dynamic objects have the following parameters:
- Mass. The mass of a dynamic object defines how easily it can be moved. Objects with higher mass will affect the lighter objects more and vice versa the lighter objects will affect the heavier ones less.
- Friction. The friction of a dynamic object defines how easily it will slide over other surfaces. By default, the friction is set to 100. If you set the friction of a dynamic object to 0, it will slide endlessly over other objects.
- Bounciness. The bounciness of a dynamic object defines how far it will move away from other objects after it hits them. By default, the bounciness is set to 50. The higher the value, the bouncier the dynamic object will be. If you set the bounciness of a dynamic object to 0, it will not bounce on or off other objects at all.
Note that you can use the following Lock settings for a dynamic object. These settings help you to build more stable and predictable game mechanics:
- Position. This restricts the dimensions in which a dynamic object can move. For example, if you lock the Z-axis of an object, it will only move up or down and forward or backward, and it won't move sideways.
- Rotation. This restricts the dimensions in which a dynamic object can rotate.
- Rigidbody Enabled/Disabled
- Rigidbody Type