---
name: stealth-grass-vision
description: Implement reliable Tall-Grass Stealth & Guard Vision Cone Detection (Trigger Box + Foot/Toe Overlap + Coyote Stealth Grace + Proximity Bump Reveal + Gradual Suspicion Gauge) without fragile per-pixel mesh occlusion or jarring 1-pixel binary alert snaps.
---

# Tall-Grass Trigger Box & Guard Vision Cone Stealth (EP31)

## Core Problem: Why Real 3D Mesh Occlusion Breaks Stealth Games (And Why Pure Binary Boxes Feel Janky)
- **Trap A — Pure Line-of-Sight Raycast Only**: If guards raycast against your character's head or weapon sticking out above knee-high grass, players get spotted constantly despite feeling visually hidden — stealth becomes frustrating and unreadable.
- **Trap B — Raw Binary Trigger Box Only**: Setting `player.hidden = isToeInsideTriggerBox` makes stealth readable (used in *Honor of Kings*, *Assassin's Creed* bushes, and classic arena games), **but** without an edge grace window or proximity bump check, stepping 1 pixel past the wireframe triggers a 0ms telepathic full-room alert while guards literally walking through your face stay blind.

## 5 Production Rules (Ship-Ready Stealth Architecture)

1. **Rule 01 — Volume-First Stealth Trigger Box (Never Raycast Individual Grass Blades)**:
   - Place an explicit AABB / Capsule `TriggerBox` under every stealth bush. Test the player's **foot/toe collider** against the Trigger Box so visual props (swords, capes, helmet crests) never cause unfair false positives.
2. **Rule 02 — Post-Exit Coyote Stealth Grace (`320–420ms`)**:
   - When the player's toe clips 1px outside the Trigger Box edge, keep `stealthActive = true` for a `360ms` grace timer before breaking stealth — preventing accidental "half-step instant alert" frustration.
3. **Rule 03 — Close-Range Proximity Bump Reveal (`40–48px`)**:
   - Add an inner body-collision radius around guards: even inside tall grass, if a guard walks literally face-to-face into the player's body, break stealth cleanly so AI feels believable.
4. **Rule 04 — Gradual Suspicion Gauge (`0% -> 100%`) Instead of 0ms Telepathy**:
   - Fill a visible `?` -> `??` -> `!` suspicion meter scaled by distance (`closenessMult`) instead of instant frame-0 alert so players always have a fair window to duck back into cover.
5. **Rule 05 — Always Provide a Debug Wireframe Overlay**:
   - Render the Trigger Box bounds (`green = active`, `red = inactive`) and guard FOV cones in dev builds so level designers can verify bush footprints match artwork.

## Verification Checklist
- [ ] Toe 2px inside Trigger Box keeps player hidden under direct guard FOV sweeps (exposed head/weapon ignored).
- [ ] Stepping outside the Trigger Box under Binary mode snaps alert immediately (`0ms`), while AAA mode grants a `>= 300ms` reaction window.
- [ ] Close-range bump (`<= proximityRevealPx`) overrides grass stealth cleanly in Assassin / AAA presets.
- [ ] Disabling Trigger Box (`raw-los`) immediately exposes the player to sweeping guards, proving why Trigger Boxes are required.
