On Collision Vs. On Trigger — When to use them?

Colliders interact differently depending on how they are set up Static, Dynamic, or Trigger.

There are basically two types of collisions that can happen hard surface collisions and trigger collisions. Game objects can be set up differently and these collisions happen depending on if they are Static Collider (No rigidbody attached), Rigidbody Collider (normal rigidbody attached), Kinematic Rigidbody Collider (rigidbody with Is Kinematic property enabled), or a Trigger Collider (Static Collider, Rigidbody Collider, or Kinematic Rigidbody Collider; with Is Trigger property enabled).

On Collision Events

Use On Collision Events (OnCollisionEnter, OnCollisionExit, and OnCollisionStay) when you have a hard surface collision. This is a collision that happens when physics is involved, like a car crash, a ball bouncing off the wall, a person landing on the ground after falling/jumping. These events are sent if one of the colliders is a Rigidbody Collider.

  • Ridgidbody Collider — Static Collider
  • Ridgidbody Collider — Ridgidbody Collider
  • Ridgidbody Collider — Kinematic Ridgidbody Collider

On Trigger Events

Use On Trigger Events (OnTriggerEnter, OnTriggerExit, and OnTriggerStay) when you have a trigger collision. A game object passing through another object but not causing physics to be applied (power up, coin, start a cut scene, teleport the player to another location, or a characters hit box). Both game objects must contain a Collider component. One object must have Collider.isTrigger enabled, and one object must contain a Rigidbody.

  • Static Trigger Collider — Ridgidbody Collider
  • Static Trigger Collider — Kinematic Ridgidbody Collider
  • Static Trigger Collider — Ridgidbody Trigger Collider
  • Static Trigger Collider — Kinematic Ridgidbody Trigger Collider
  • Ridgidbody Trigger Collider —Static Collider
  • Ridgidbody Trigger Collider — Ridgidbody Collider
  • Ridgidbody Trigger Collider — Kinematic Ridgidbody Collider
  • Ridgidbody Trigger Collider — Ridgidbody Trigger Collider
  • Ridgidbody Trigger Collider — Kinematic Ridgidbody Trigger Collider
  • Kinematic Ridgidbody Trigger Collider — Static Collider
  • Kinematic Ridgidbody Trigger Collider — Ridgidbody Collider
  • Kinematic Ridgidbody Trigger Collider — Kinematic Ridgidbody Collider
  • Kinematic Ridgidbody Trigger Collider — Kinematic Trigger Ridgidbody Collider

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store