feat: directed stumble — first active survival reaction (0.4.0)#89
Merged
Conversation
A staggering hit now visibly SHOVES the character instead of being absorbed: the root drifts along the hit direction so the reaction displaces it, the trailing foot steps to follow (placed ahead of the hips, kept in its own lane so feet don't cross, and lifted along an arc so it steps rather than slides), and the lower body stiffens to stay upright while the upper body stays loose and reacts to the momentum. The character commits to the reaction (tip-over->ragdoll suspended while stumbling) and ends up displaced before recovering to idle. Strong hits still ragdoll; light hits just wobble. This supersedes the original EMERGENT balance-band catch, which was invisible and unreliable in practice (most hits never reached the band or blew past it, and a foot reposition on a rigid body read as nothing). The directed model is reliable, visible, and art-directable — closer to how Euphoria actually works (triggered behaviors, not pure emergent physics). The now-unused StumblePlanner decision class is removed. - ActiveRagdollController: _update_directed_stumble / _do_directed_step driven from _start_stagger's hit direction; differential stiffening via _apply_stumble_brace (lower body only); stumble_step_started signal. - FootIKSolver: begin_stumble()/is_stepping() with a sine lift arc, reusing the existing stagger pin/IK/override plumbing. - RagdollTuning: "Self-Preservation: Stumble Steps" group (push_speed, push_decel, step_lift, step_length, step_duration, max_steps, brace_strength, ...). - docs/SELF_PRESERVATION.md (records the directed design + the pivot); ROADMAP 0.4.0 -> in progress; CHANGELOG. Tests: test/test_stumble_step.gd drives the real controller+foot IK on a live rig — a staggering hit displaces the character + fires steps, and disabling suppresses it. Motion quality is validated visually (the synthetic rig's emergent fall is too nonlinear to assert). GUT 116/116, import clean. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This was referenced Jun 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The first active self-preservation reaction for 0.4.0: a staggering hit now visibly shoves the character — it lurches in the hit direction, the feet step to follow, the upper body reacts, and it ends up displaced before recovering to idle.
This consolidates and supersedes #83, #84, #85 (which describe an earlier emergent approach that was reworked — see below). One clean PR for the whole feature.
The pivot it records
The first attempt drove stumbling emergently (wait for the centre-of-mass to drift into a balance band, then make a small foot reposition to "catch" it). In practice it was invisible and unreliable — most hits never reached the band or blew straight past it to a ragdoll, and a foot reposition on an otherwise-rigid body read as nothing.
Reworked to be directed, which is closer to how Euphoria actually works (triggered behaviors, not pure emergent physics): the hit triggers the reaction reliably, it's big (displaces the character), and it's art-directable. The now-unused
StumblePlannerdecision class is removed.How the directed stumble works
stumble_push_speed, decaying atstumble_push_decel); the springs pull the body along, so the whole character moves.stumble_step_lengthof travel the trailing foot steps, placed ahead of the hips and kept in its own lane (no crossing), lifted along a sine arc (stumble_step_lift) so it steps rather than slides.stumble_brace_strength) to step + stay upright; the upper body stays loose and reacts to the momentum (purposeful legs, reactive torso/arms/head).Built on the hardened active-ragdoll springs (foot-IK orientation fix + spring settle deadband, already on
main).Changes
ActiveRagdollController—_update_directed_stumble/_do_directed_step(hit-driven),_apply_stumble_brace(lower-body-only stiffening),stumble_step_startedsignal.FootIKSolver—begin_stumble()/is_stepping()with the lift arc, reusing the stagger pin/IK plumbing.RagdollTuning— "Self-Preservation: Stumble Steps" group.docs/SELF_PRESERVATION.md(directed design + the pivot), ROADMAP 0.4.0 → 🚧, CHANGELOG.Validation
test/test_stumble_step.gddrives the real controller + foot IK on a live rig: a hit displaces the character along the hit direction + fires steps; disabling suppresses it). Motion quality validated visually on the real ybot (the synthetic rig's emergent fall is too nonlinear to assert).Follow-up
Arm bracing (the upper-body active layer — windmill + reach) is next, and completes the 0.4.0 milestone.
🤖 Generated with Claude Code