Files
stickman/docs/archive/plans/PHASE_6a_AIRBORNE_LANDING.md

5.1 KiB

Phase 6a Architecture Proposal: Airborne Momentum, Dynamic Air-Pose & Landing Impact Absorption

1. Executive Summary

Phase 6a extends the shipped Phase 6 continuous terrain locomotion system by replacing rigid vertical free-falls and instant landings with dynamic, momentum-driven airborne physics. It introduces horizontal air momentum decay, procedural wind-drag pose flailing during fall, and velocity-proportional landing impact compression that temporarily holds action queue execution.


2. Technical Mechanics & State Integration

2.1 Airborne Horizontal Momentum Decay

  • Momentum Snapshot: Upon detecting a loss of ground support during ANIMATED mode, StickmanRig caches the last horizontal velocity (v_x) from navigation or manual walking.

  • Parabolic Arc: During free-fall frames, v_x continues to shift root X while applying exponential air drag (\text{AIR\_DRAG\_X} = 4.0). Vertical gravity (TERRAIN_GRAVITY) accelerates Y down to TERRAIN_MAX_FALL_SPEED.

2.2 Procedural Air Pose & Wind-Drag Flail

  • Limb Displacement: As downward velocity (v_y) increases, upper limb IK_Targets blend away from AnimationTargets/*_Base markers, pulling hands above the head to simulate wind resistance.

  • High-Frequency Flail: Layer anti-phased sine-wave offsets (\sim 12\text{ Hz}) onto hand and foot IK targets, scaling amplitude with v_y to create a realistic airborne fluttering effect.

2.3 Landing Impact Compression & Queue Hold

  • Velocity Capture: On _probe_ground_y() contact detection, record the final impact fall speed (v_{\text{impact}}).

  • Impact Absorption: If v_{\text{impact}} \ge \text{MIN\_IMPACT\_VELOCITY}, trigger a 2-phase pelvis squash tween:

  1. Compress: Rapidly ease pelvis Y downward (\sim 0.08\text{s}) into a deep crouch, forcing leg TwoBoneIK solvers to flex while feet stay locked to ground contacts.

  2. Recover: Spring pelvis Y back up to standing terrain height (\sim 0.22\text{s}) using a sine-out easing curve.

  • Queue Synchronization: Set an internal _is_landing_impact flag during absorption to pause action_queue processing, resuming automatically once standing recovery completes.

3. Component & API Specification

Component Target System Implementation Details
Momentum Tracker StickmanRig._physics_process() Snapshot v_x at fall transition; apply v_x \cdot \Delta t with exponential decay to root X during free-fall.
Air Pose Solver StickmanRig IK Stack Offset live arm/leg IK_Targets dynamically relative to base markers based on v_y.
Impact Absorption StickmanRig Terrain Controller Run pelvis squash/spring tween on ground contact; hold action_queue until complete.

4. Verification & Acceptance Criteria

  • Ledge Ejection: Walking off an elevated ledge projects the rig outward in a parabolic curve rather than dropping straight down.

  • Air Flail: Arms flex upward and hands/feet flutter rhythmically during high-speed free-fall.

  • Impact Cushion: Drops exceeding minimum velocity threshold exhibit a visible knee bend and pelvis compression before standing up.

  • Queue Order: Action queue execution halts during landing impact recovery and resumes cleanly without dropping or skipping pending actions.

5. Open Questions and Edge Cases

To ensure the implementation runs smoothly, here are the key edge cases and technical questions your architect should clarify before finalizing Phase 6a:

  • Ragdoll Escalation Threshold: If the fall velocity (v_{\text{impact}}) exceeds a extreme safety limit, should the stickman escalate into a full dynamic ragdoll collapse instead of executing a soft crouch-and-recover animation?

  • Mid-Air Wall Collisions: How should horizontal air momentum (v_x) react if the stickman drifts laterally into a vertical wall or prop before touching the floor? Should horizontal velocity immediately zero out on wall contact to prevent body clipping?

  • Sloped Landing Compression: How does pelvic squash behave when landing on an angled ramp or stair tread? We need to confirm whether left and right foot IK targets remain independently anchored to unequal terrain elevations while the pelvis squashes downward.

  • Action Queue Preemption: If a dynamic trigger fires or a user issues a new direct action while the stickman is airborne or mid-landing crouch, should the incoming action cancel the landing recovery sequence or wait at the front of the queue?

  • Custom Pose Overrides: How should wind-drag flailing blend if the character goes airborne while performing a non-locomotion action (like holding an item or attacking)? Should flailing override all hand keyframes, or only apply during default walk/idle states?