Collisions and Triggers in Unity
A common way to have things interact with each other is through the use of triggers or collisions. Both use the same component type (Collider), just that one is set as “Is Trigger”. A rigidbody component is required, by at least one of the gameobjects, for them to be able to interact.
The difference
I like to picture it like so:
- A collider in its normal state functions similarly to a solid object, like a wall.
- A trigger is like a laser detection beam, when you enter into the “trigger zone” it signals that something has entered the area.
I don’t mind running through a laser detection beam, but through a wall? Not so much! 😅
You’re not limited to use just one or the other on your gameobject. You can have multiple different types of shapes and mix between “solid” and “trigger” versions. It just depends on your needs, as a collider can extend outside of the actual physical dimensions of the gameobject.
The Component
The component lets you edit the size of the collider. Clicking this will show a green outline on your gameobject, it will have a few “dots” that you can drag to resize.
Alternatively, you can enter the dimensions and the center position of it manually.
The “Is Trigger” box does just as you might imagine, toggles it from “Solid-” and “Trigger-mode”