What are rigidbodies, triggers, and colliders?
With the Rigidbody component, we can add and control forces on that object realistically. For example one of the properties we can add is gravity
There are many properties in the Rigidbody component and you can find more info about them from here
Triggers are good for soft collisions, like stepping on a platform that does something or triggers a certain event in a game (Conversation, music, etc…)
To use trigger you use
There are few options for you to choose, OnTriggerEnter, OnTriggerExit, OnTriggerStay.
I used a trigger collider in one of my previous articles, you can see it here
In the trigger component, you can choose if it reacts when another collider touches it.
You can either go through the trigger or stop like it would be a wall.
There are many colliders which you can use inside Unity3D.
Some of them are made for 3D and some for 2D.
The primitive colliders for 3D are Box, Sphere, and Capsule Colliders.
And for 2D there are Box Collider 2D and Circle Collider 2D.
When creating a compound collider it’s important that you add a Rigidbody component to make it work.
To make your collider even more accurate in your game object, you should use a Mesh Collider. But be careful, because these colliders are pretty processor-intensive. So use them carefully.
In box collider you have an option to make it “Is trigger”, but in mesh collider, you first need to check “Convex” and then “Is trigger”.
These colliders don’t need a rigidbody. Static colliders are usually floors, ground, walls, or just objects which don’t move.
Thank you for reading this! And in the next one, I will be showing more about How and when to use collisions and triggers! :)
Much love and see you in the next one! :)