T . Kathiravan

May 1, 2021

2 min read

Introduction to Physics in Unity

Use Unity’s built-in physics engine that corresponds to your needs:
Built-in 3D physics (Nvidia PhysX engine integration)
Built-in 2D physics (Box2D engine integration)

Let's see some of the physics-related concepts
Rigidbodies : A Rigidbody is the main component that enables physical behaviour for a GameObject with a Rigidbody attached, the object will immediately respond to gravity. This includes reactions to forces and gravity, mass, drag and momentum.

We should not try to move the GameObject with the Rigidbody attached using Transform properties rather we should apply forces to push
the GameObject and let the physics engine calculate the results.Attach a Rigidbody to your GameObject by simply clicking on Add Component and typing in Rigidbody2D(for 2d ) and Rigidbody(for 3D) in the search field.


When Rigibody is attached gravity reacts on the physics object and it falls down , so to avoid that we can check off Use Gravity from the Inspector panel

Use Gravity

Colliders: Collider components define the shape of a GameObject for the purposes of physical collisions. A collider, which is invisible, does not need to be the exact same shape as the GameObject’s mesh. A rough approximation of the mesh is often more efficient and indistinguishable in gameplay.

The simplest colliders are primitive collider types.
In 3D, these are the Box Collider, Sphere Collider, and Capsule Collider
In 2D, you can use the Box Collider 2D and Circle Collider 2D. You can add any number of these to a single GameObject to create compound colliders.