OnCollisionEnter Vs. OnTriggerEnter — When to use them?

Richard Morgan
1 min readMay 8, 2021

Diving deeper into collisions and triggers, we discussed in the previous article how Rigidbody collisions create force reactions and Triggers allow objects to pass through each other. Now let’s discuss when and how to use each.

Triggers allow objects to communicate their location to other objects so that when two objects are ‘touching’ a response can be generated. There are 3 trigger states included with MonoBehavior:
1) OnTriggerEnter
2)OnTriggerExit
3)OnTriggerStay

Here we’re demonstrating how an OnTriggerEnter event can be used to create the appropriate response depending on the tag of the ‘other’ object colliding with this object:

Using the ‘other.tag’ of the colliding object we can then react by damaging the other object or destroying it completely. In this case we’re able to communicate with the other object’s methods because the reference to the other object has been provided through the trigger. More on that in the next article.

--

--