TRIGGER VS COLLISION IN UNITY: COMPLETE COMPARISON

Understand the exact physics conditions for OnTriggerEnter and OnCollisionEnter, contact normal generation, and sensor zone best practices.

1. High-Level Comparison Summary

Solid Collision (isTrigger = false)
Physical Response: Solid obstacle. Objects rebound, bounce, or stop. Generates contact impulses and friction.
C# Callbacks: OnCollisionEnter, OnCollisionStay, OnCollisionExit.
Callback Data: Passes full Collision object (contact points, impact velocity, relative momentum, surface normal).
Use Cases: Walls, ground terrain, vehicle crashes, missile impacts.
Trigger Zone (isTrigger = true)
Physical Response: Invisible volume. Objects pass through freely without physical resistance or bounce.
C# Callbacks: OnTriggerEnter, OnTriggerStay, OnTriggerExit.
Callback Data: Passes lightweight Collider handle (no contact point calculations).
Use Cases: Coin pickups, checkpoints, door sensors, mission objective zones.

2. The Mandatory Rigidbody Rule

For either a collision or trigger callback to fire between two objects in Unity, at least ONE of the two colliding GameObjects MUST have a Rigidbody attached!

⚠️ Why OnTriggerEnter Fails to Fire

If you create a Coin with a BoxCollider (isTrigger = true) and a Player with a CapsuleCollider (isTrigger = false), but neither object has a Rigidbody, PhysX treats both as static objects and no trigger event will ever fire. Attach a Rigidbody (with isKinematic = true) to either the Coin or the Player.

3. C# Code Implementation

using UnityEngine;

public class CollisionDetector : MonoBehaviour
{
    // 1. SOLID COLLISION CALLBACK
    private void OnCollisionEnter(Collision collision)
    {
        // Contact points are available
        ContactPoint contact = collision.GetContact(0);
        Debug.Log($"Impacted {collision.gameObject.name} at normal {contact.normal} with impulse {collision.impulse.magnitude}");
        
        // Spawn spark/debris particle at exact hit point
        // Instantiate(sparkPrefab, contact.point, Quaternion.LookRotation(contact.normal));
    }

    // 2. TRIGGER SENSOR CALLBACK
    private void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Pickup"))
        {
            Debug.Log($"Collected item: {other.name}");
            Destroy(other.gameObject);
        }
    }
}

Related Topics & Error Fixes

Frequently Asked Questions

Yes, Triggers are significantly faster because PhysX only checks for bounding box/capsule overlap without performing contact manifold generation, penetration depth resolving, or friction physics solver matrix steps.
Yes! This is known as a Compound Collider setup. You can attach a solid CapsuleCollider for player body collisions, and a larger spherical child collider marked with isTrigger = true to act as an interaction proximity sensor.