OnCollisionEnter Vs. OnTriggerEnterWhen to use them?
Objective: When and how to use OnCollisionEnter and OnTriggerEnter in Unity.
Today were gonna discuss how and when to use OnCollisionEnter and OnTriggerEnter. So one thing you will notice in our Space Shooter is that our Player, Laser, Enemy all have box colliders. So what do box colliders have to do with OnCollisionEnter and OnTriggerEnter, well box colliders detect collisions in your game world. Another thing you will notice is that our objects are not colliding because we haven’t enable the physics system in Unity. One way we can add physics properties in Unity is through a Rigid body to an object. OnTriggerEnter is when a game object passes through another game object giving off an appearance as if was collected like a power up in Mario kart. OnCollisionEnter is when a game object collides with a wall or a ball bouncing off a wall . These are the differences between the two.