Body step 2: the player is a muscle-driven ragdoll (Project TX)

PlayerRagdoll: 9 bodies, spine/neck ball joints, shoulder drives (girdle + muscle),
elbow hinges, torque-capped motor PDs toward the True Body, chest->hand guides,
implicit balance motor, mass-scaled ground control. PlayerRig: XR driver with
stick move / snap turn and Bonelab-style push-back (eye->camera sphere sweep).
Replaces the chase bodies in main.tscn; RagdollSpike regression (14 phases).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
FoxyzandClaude Opus 5.5 committed 2026-10-02 06:43:52 +03:00
1 parent d0b50fbc41
commit d83273dd2f
16 files changed
+1487 -28

No files matched your search

+29 -3
View File
@@ -78,6 +78,22 @@ TERMINOLOGY (owner-corrected — use precisely):
head. Grip is suppressed while that hand prop-grabs (`PropGrabber.IsGrabbing`) or the panel is
near (`WorldPanel.IsBlocking`). **All deltas and turn pivots in WORLD space** (tracking-space math
made turns orbit the map center — do not regress). Drives `XROrigin3D` directly.
- **PlayerRagdoll.cs + PlayerRig.cs (body step 2, 2026-10-02) — THE PLAYER BODY in `main.tscn`.** The player is a
muscle-driven ragdoll (Nimso's Project TX): 9 boxes (pelvis carrying the legs' mass, chest, head+neck, upper arm,
forearm, hand ×2; 60 kg), spine/neck BALL joints + elbow hinges + shoulder DRIVEs (girdle translation + shoulder
muscle in one joint) with torque-capped motor PDs (feed-forward + Kp·RotationError) toward the True Body pose; hands
pulled onto the controllers by a 40 N chest→hand guide; balance = implicit motor from a world anchor; ground control
= mass-scaled support PD on the pelvis while a ray finds ground. `PlayerRig` (XR driver) per physics tick:
discrete origin jumps (spawn/teleport) carry the body → left-stick move (head-relative 2.2 m/s) / right-stick snap
30° (`SmoothTurn` constant) → `OriginCorrection` (camera 1:1; a 3 cm sphere swept eye→camera pushes the view back
when geometry is in the way, free lead ≤ 0.2 m, floor follows the ground, airborne the view rides the body) →
True Body solve → `Step`. Sticks whose hand points at the menu don't move/turn (`WorldPanel.IsPointing`).
`PhysicsHands.GetBody` falls back to the ragdoll's hands and `PropGrabber` calls `PlayerRig.SetHeld` (arm↔prop
collision exceptions), so grabbing works unchanged. Hand ghosts at > 10 cm lag. Rebuilds on recalibration. Full
design + measured findings: `research/ragdoll-player-step2.md` (incl. the light-link oscillation rule).
Regression `scenes/ragdoll_spike.tscn` "RAGDOLL: overall PASS" (stand, reach, swings, stick + room-scale wall,
bar blocked/crouch under, lean over table, crate push, 12 kg close vs far, teleport + snap turn, random soak).
- **LEGACY (not in main.tscn since step 2; kept for their spikes): PhysicsHands / PhysicsTorso / PhysicsArms / BodyRig.**
- **PhysicsHands.cs** — physical palm bodies chasing the controller poses: 0.4 kg boxes (flat slab,
thumb-side face), gravity off, CCD, **layer 4 (player hands)/mask 1|4** — NOT colliding with the
chest (layer 3), excluded both ways. Chase = desired velocity `(target-pos)/dt`
@@ -356,6 +372,12 @@ Floor StaticBody mask 1|3|4|5 (collision_mask 29).
## 5. Known issues / open questions
- **Ragdoll player (step 2) — unvalidated in-headset.** Known gaps (details in
`research/ragdoll-player-step2.md`): no legs yet; shoulder has no cone limit; grabs are props only (no
climbing on static geometry); strength values are human-scale guesses; physics still at the headset rate
(144 Hz not switched); legacy anchor-grab movement now fights gravity (the body falls, the view follows), so
it only pulls you along the ground; teleport markers still work (the body is carried).
- **Body Stage 1 chest collapse — ROOT-CAUSED + FIXED (2026-10-01), awaiting owner re-playtest.**
The first in-headset session NaN'd the chest ("head detaching from the body"). Cause was
SCRIPT MATH, not the solver: the orientation servo used `Quaternion.GetAngle()` = `2*acos(W)`
@@ -500,9 +522,13 @@ Floor StaticBody mask 1|3|4|5 (collision_mask 29).
## 7. Next steps (in order)
0. **Owner playtest of body step 1** — T-pose calibration (forced on first launch; delete `prefs.json` to redo,
or the menu's Recalibrate), arm length should now match; judge the cyan True Body skeleton (shoulders that
shrug/reach, crouch lean, hip sway, elbows). Then body step 2 = the muscle ragdoll on the 6-DOF joints.
0. **Owner playtest of body step 2 (the ragdoll player)** — stand, reach, push props, grab/hold (strength is now
human-scale: heavy things only close to the body), walk with the left stick into walls/the table, snap turn
with the right, crouch. Read the log after ("PlayerRagdoll: ... snapped" = a safety reset). Tuning knobs:
`PlayerRagdoll` strength/gain constants, `PlayerRig.MoveSpeed/SmoothTurn`. Step 1 (calibration, True Body)
was validated by the owner ("seems normal"); `TrueBody.ShowDebug` is off now that the ragdoll is the visual.
Next body steps: procedural legs, 144 Hz (needs physics interpolation + origin moves in physics ticks),
climbing (weld to static), one global strength scalar.
1. **Owner re-playtest of the body (chest fix + Stage 2 arms)** — the Stage-1 collapse is
fixed (`collapse_spike` 49/49); feel is unvalidated in-headset. Read the log after.
2. **Locomotion decision** — owner report 2026-10-01: two-hand anchor turning broken (not