Tier 2 Series 103

103E: The Trigger Threshold

Pilot Record
Student Profile
"If a sensor beeps 60 times a second, the pilot will smash the speaker. If your healing zone heals +1 health 60 times a second, the player becomes invincible. A skilled Engineer audits for Rate Limiting."

The Concept: Debouncing

Physics engines run at high speed (usually 50-60 times per second). Logic inside `OnTriggerStay` will execute at this rate unless you throttle it. We use **Timers** to "Debounce" the logic.

* **The Cooldown:** `nextTime = Time.time + rate;`
* **The Check:** `if (Time.time > nextTime)`
Red Flag Detected

The AI Trap: "The Rapid Fire"

You ask the AI: "Heal the player when they stand on the pad."

// AI-Generated Code: Game-Breaking Speed
void OnTriggerStay(Collider other) {
    // Audit Fail: Heals 60 HP per second.
    // Instantly refills health to max.
    player.Heal(10);
}

This is "Frequency Overload." Without a timer, the mechanic is unbalanced and uncontrollable.

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
// Corrected: Balanced Logic
private float nextHealTime;

void OnTriggerStay(Collider other) {
    if (Time.time > nextHealTime) {
        player.Heal(10);
        nextHealTime = Time.time + 1.0f; // Wait 1 second
    }
}
Your Pilot Command
> Direct the AI to use Inverse Kinematics (IK) for procedural foot placement on uneven terrain.
Next Mission
The Physics Query Audit