One of the many benefits to using an engine like Unity is that it has built in physics components we can add to objects to make them behave a certain way. General behaviors like gravity and how the weight of an objects affects other objects can be easily manipulated without having to code every single interaction ourselves.

One of the most commonly used component regarding Unity physics is the rigidbody.

As you can see in the image above, the check mark next to gravity enables the engine to apply gravity to the object the rigidbody component is attached to. Rigidbody also allows us to change the mass of the object. If two objects of different mass collided with each other while rigidbody was enabled, the engine would know that the object with more mass wouldn’t be affected as much as the object with less mass.

Speaking of collisions, Unity has a separate component to check for them.

Box Collider is the component that allows Unity to detect when objects interact with one another. It stores information of the collided objects to that we may access it when scripting and modify what happens.

The is Trigger box is important depending on what you want to happen when the objects collide. If you want one of the objects to disappear when another touches it, as if it is getting collected by a player, then checking the box would be the way to go. Otherwise, leaving it blank would allow the engine to apply visible physics to the object accordingly.

There is much more to touch on when it comes to physics in Unity, but this is a good place to start. You can always search through Unity’s resources regarding physics if you want to explore more.

Max is demonstrating the effects of gravity

Currently learning to code with the help of GamedevHQ in order to someday my my game ideas come to life!