Basic physics in Unity

One of the amazing things with Unity is that it comes with a built in physics engine. Below I will briefly go over the component that can turn a basic cube into an object that follows the laws of physics or just part of it.

The component that enables physics on an object is called a Rigidbody and it can be attached to just about anything. To add a Rigidbody component just select the object you want to add it to, click Add Component and then select Rigidbody. If you are working on a 2D object you would choose Rigidbody 2D.

01. Mass
The Mass setting determines how heavy an object is and is measured in kilograms.
The following two gifs will show you the difference between 1 kilogram vs 10 kilogram sphere:

02. Drag
Drag determines how much air resistance an object has. Below you can see the difference between with Drag set to the default value 0 and with it set to 5 on the cubes:

03. Angular Drag
Angular drag determines the amount of rotational air resistance. Below you can see the difference between the default value of 0.05 and with Angular Drag set to 1000.

04. Use Gravity and Is Kinematic
Use Gravity is exactly what it says on the tin and determines if this object should be effected by gravity. Is Kinematic determines if the object should respond to external force. If Is Kinematic is enabled, the object can only be manipulated via the Transform component.

05. Constraints
If you want to restrict an object from moving or turning a certain way you can enable restrictions. This can be very useful if you use a 3D object in a 2D scene and do not want it to move away from or towards the camera. Below the cubes have been restricted on the Z position and on X and Y rotation:

Good luck!



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