OnCollisionEnter VS OnTriggerEnter

--

When working with Unity sometimes you come across multiple functions that look like they could be very similar. In the instance of OnCollisionEnter and OnTriggerEnter they look like they could function the same way. They do however serve two distinct purposes.

OnTriggerEnter is passed the other collider that the game object has entered. This can then be used to interact with the other object that has been entered.

OnCollisionEnter however is passed the collision information like at what points on the object did the collision happen and what was the velocity of the collision. This information can be used to change how the object will react to the collision.

This is a simple explanation of these two functions. You can learn more about how to use them in the Unity documentation.

Good Luck Adventurer!

-Chris

--

--

No responses yet