Tier 2 Series 103

103B: The Collision Matrix

Pilot Record
Student Profile
"If every car on the highway had to check if it was crashing into every single mosquito, the highway would stop. Physics engines work the same way. If your drone checks for collisions with its own bullets, its own shield, and the dust particles in the air, you've created Calculation Drag. A skilled Engineer audits for Layer Ignore."

The Concept: The Layer Collision Matrix

The **Collision Matrix** is a grid in Unity's Physics Settings that defines which layers interact with which. By unchecking boxes, you tell the physics engine to "Ignore" calculations between those layers entirely.

* **Optimization:** Disabling Player vs. Player collision saves CPU cycles.
* **Gameplay Logic:** Ensuring "EnemyBullets" don't hit "Enemies" prevents friendly fire accidents.
Red Flag Detected

The AI Trap: "The Universal Collider"

You ask the AI: "Make sure the drone collides with everything."

// AI-Generated Code: Calculation Waste
void OnCollisionEnter(Collision other) {
    // Audit Fail: The physics engine is already wasting CPU 
    // calculating collisions with dust, UI, and triggers 
    // that we don't care about.
    if (other.gameObject.tag == "Enemy") Die();
}

This is "Calculation Waste." The AI writes code to filter collisions *after* they happen. A professional filters them *before* they happen using the Matrix.

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 Correction

Corrective Protocol
// No Code Required! 
// This is an Architectural Audit.
// Edit -> Project Settings -> Physics -> Collision Matrix
// [ ] Player vs Debris (Unchecked)
Your Pilot Command
> Use a Blend Tree to handle smooth transitions between walk and run states.
Next Mission
The Layer Mask Filter