OnCollisionEnter Vs. OnTriggerEnter
What is the Difference between OnCollisionEnter and OnTriggerEnter?
- OnCollisionEnter is called when two game objects with colliders have collided. This method will contain physics information and will affect the physics. An example of this would be in a driving game when the car hits another car and they wreck.
- OnTriggerEnter is called when one game object with a collider passes through another game object with a collider marked as isTrigger. This method will collect data about the isTrigger game object and will not effect the physics of the game directly. An example of this is when you want to allow a character to have the ability to walk through a wall and you want to collect data about the wall or the player when they interact.