Playing with Blocks: A brief intro into Physics in Unity.

Edward Kim
3 min readMar 30, 2021

--

Physics can be complicated…. thankfully Unity makes it easy!

Physics in Unity require two things. First is a Collider of some sort, the second is a Rigidbody.

The Collider itself acts as a sort of hit area (A hitbox for anyone who understands that term) for the object in question. There are box colliders, sphere colliders, etc for what shapes you can make.

However a Rigidbody is what actually puts physics such as gravity and collision in to play.

Experimenting around with this all leads to some funny situations I have to say as you can see below with 3d objects in Unity.

As long as one of the objects that collides with another has a Rigidbody, and colliders are present, physics happen! This is a Hard Surface Collision, where two objects are physically touching each other and causing something to happen.

If the “Is Trigger” is selected in the collider,

The objects will just pass through each other, however they did “Collide” in that their Colliders had come in contact. This is a Trigger Collision and things such as taking a hit in a fighting game, collecting coins in Mario, etc are all examples of this. Our space shooter will be working with Trigger Collisions 100% and I am going to have to get very well acquainted with this.

Gravity is also a option that can be toggled in the Rigidbody as well, though there are ways to create your own Gravity in code. A little more advanced from where I am at, at the moment however.

Physics always involves math so I fear the more advanced physics in Unity, but it will be definitely fascinating as well!

Keep trucking on, and see you next article!

--

--