Basic Introduction to Physics in Unity

Objective: To help explain the basic understanding of the Unity physics system if you are new to Unity.

Unity has built in Physics engines which enables objects to be controlled by forces that exist in the real world. E.g. Gravity, acceleration, velocity, mass , drag etc.

Adding a Rigidbody component to the game object will place that object under the control of the Unity physics engine. So far I haven’t added any Rigidbody components to my game objects but let’s have a look at what happens when I do:

No Rigidbody component attached:

No Rigidbody attached — Player game object stands still

Rigidbody component attached:

Rigidbody attached
Rigidbody attached — Watch the player game object fall when the game starts

Tip: There are Rigidbodies for both 2D and 3D. 2D works in a similar way but the forces are applied to the X and Y axis only. If you accidentally add the wrong Rigidbody to your game and you have an existing collider already attached, it should prompt you with a warning that you cannot add this. E.g. I have an existing Box Collider 2D on my player and when I go to add the 3D Rigidbody I get this warning:

Conflicting collider and Rigidbody warning for 2D and 3D

Useful Links:
https://docs.unity3d.com/ScriptReference/Physics.html
https://docs.unity3d.com/ScriptReference/Physics2D.html
https://docs.unity3d.com/2020.1/Documentation/Manual/class-Rigidbody.html
https://docs.unity3d.com/2020.1/Documentation/Manual/class-Rigidbody2D.html

--

--

--

Passionate Unity Game Developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Installing Harbor using VM Operator on vSphere

Playing with your C program at machine level

Java Variables: Guide For The Complete Beginners

ECMA(European Computer Manufacturer’s Association)ES5 vs ES6

Binary Numbers and Use in Computers + How to make a base conversion program in python

Bombe, a general purpose computer made by Alan Turing to crack the german Enigma Code during World War II

Good Data at Good Eggs: Correctness and reliability for data infrastructure | Dagster Blog

How I got from being an idiot to an idiot who knows how to program

Shelves of books embraced in darkness

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Chris Hilton

Chris Hilton

Passionate Unity Game Developer

More from Medium

Coroutines in Unity!

Learn to code by making a 2D space shooter game.

Sphere Scene in Unity URP

Camera Plugin for Unity