In this article, I will briefly touch on Physics in Unity. Unity allows a game programmer to simulate physics in games so that GameObjects accurately respond within the world.
Responding to gravity, collisions, and other forces is critical to improving gameplay and player satisfaction. To achieve this, Unity provides different physics engines (2D and 3D) that a game programmer can implement. The most commonly used physics classes are Rigidbody and Colliders.
RigidBody
For a GameObject to be controlled by Unity’s physics engine, it requires the Rigidbody component. You can add a Rigidbody to a GameObject within the Inspector by clicking on the “Add Component” button.
From the Inspector panel for that GameObject, you can alter many parameters, including Drag, Mass and Use Gravity.
Rigidbody also has a scripting API that allows you to apply forces to the GameObject to control it realistically. For more information
Colliders
A Collider is used to allow a GameObject to interact within your game and is achieved by turning the Collider into a trigger. You can locate the Collider within the Inspector of the GameObject prefixed by the geometry of the GameObject (i.e. Cube = Box Collider, Sphere = Sphere Collider).
Once a Collider is a trigger, it can then be scripted to perform actions when another GameObject with a Rigidbody collides with it.
In a future article, I will cover how to uses these basic Physics components in a game. I hope this article help you understand the basics of Physics within Unity.