Tier 2 Series 100

100B: Collision Physics

Pilot Record
Student Profile
"An aircraft carrier uses a Physical Deck to land the plane, but it uses a Radio Beacon (Trigger) to guide it in. If the pilot treats the radio beacon like a solid deck, they’ll never reach the runway. In Unity, using a physical collision for a 'Power-Up' pickup is like trying to drive through a brick wall to get your fuel."

The Concept: Colliders vs. Triggers

In Chapter 5, we explore the two ways Unity handles touch. As a Flight Engineer, you must audit which "Mode" the AI is using for interaction.

OnCollisionEnter: Solid impact. Objects bounce or stop. Used for Floors, Walls, and Barrels.
OnTriggerEnter: Pass-through zones. Objects move through freely. Used for Pickups, Checkpoints, and Traps.
Red Flag Detected

The AI Trap: "The Brick Wall Pickup"

You ask the AI: "Write a script so that when the player touches a gold coin, the coin is destroyed and the player gets 10 gold."

// AI-Generated Code: Audit Failure
void OnCollisionEnter(Collision other) {
    if (other.gameObject.CompareTag("Player")) {
        // ERROR: The player will physically bump into the coin 
        // before this code runs, stopping their movement!
        Destroy(gameObject);
    }
}

A coin shouldn't have "mass" that stops a player. This creates "Ghost Collisions" where the game feels clunky and unresponsive.

Elite Telemetry

Research shows "Elite" teams achieve 15% faster lead times by keeping AI on a "very tight leash."

  • Small Batches Solving one problem at a time prevents logic drift.
  • Modular Design Localizing the "blast radius" of AI changes.
  • Tight Loops Rapid iteration with constant code review.

The Pilot's Command

Corrective Protocol
// Corrected Pilot Code: Smooth Flight
void OnTriggerEnter(Collider other) {
    if (other.CompareTag("Player")) {
        // The player glides through, triggering the event 
        // without losing momentum.
        Destroy(gameObject);
    }
}
Your Pilot Command
> A skilled Pilot uses a LayerMask to ensure the Raycast only interacts with specific objects.
Next Mission
Flight Instrumentation