OnCollisionEnter Vs. OnTriggerEnter — When to use them?

My last post was an intro into the physics engine within unity. This article is a little more on the difference between the two classes in the title.

box collider component

To help understand what they mean I checked the unity documentation.

“Collision events are only sent if one of the colliders also has a non-kinematic rigidbody attached. Collision events will be sent to disabled MonoBehaviours, to allow enabling Behaviours in response to collisions.”

Attached to this class is the rigidbody component and you can imagine this can be likened to a car crashing into a wall or another car.

“OnTriggerEnter happens on the FixedUpdate function when two GameObjects collide. The Colliders involved are not always at the point of initial contact.”

think of it as when you get a power up the object passes through you and maybe gives you health or you're at the finish line in a racing game.

Aspiring Unity Developer