Body step 2.6: landing dip, jump, stick crouch, no flip looking down, smooth view

- Look-down flip: body facing from BodyMath.HeadFacing (visor + crown), robust past vertical;
  stick direction uses it too; crouch lean pitch measured against the facing.
- Landing: falling legs touch down only within their reach, so leg strength stops the body
  below its stance (dip scales with impact, big falls fold the legs). Rise eased so gravity
  can stop it at the stance; legs untuck speed-limited. Fixed the vertical play-space
  correction leaking into ground control's feed-forward (a bounce).
- Jump on right A: countermovement dip + leg push over the stroke (crouch = higher).
- Stick crouch on right stick Y (RagdollDriver.StickCrouch: virtual floor offset).
- Menu summon on left X only.
- XR origin drawn with the bodies' physics interpolation (camera/body desync).
- RagdollSpike: landing/fall/jump/look-down/stick-crouch phases, `-- only=` filter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
FoxyzandClaude Opus 5.5 committed 2026-10-02 17:25:15 +03:00
1 parent 84df772f38
commit e821728fba
7 files changed
+1379 -1043

No files matched your search

+11 -6
View File
@@ -14,6 +14,7 @@ public sealed class TrueBodySolver
public const float ChestLeanMax = 0.75f; // rad (~43°) at a deep crouch
public const float CrouchRange = 0.5f; // crouch factor 1 when eyes are this fraction of standing eye height lower
public const float HeadPitchToChest = 0.25f;
public const float MaxHeadPitch = 2.4f; // rad; chin-to-chest looking at your feet goes past 90°
// Crawl: when the head gets so low that the hips would go through the floor, the trunk tips
// further (pivoting at the hips, hips kicking back) up to nearly horizontal (Nimso: lower = crawl).
public const float CrawlLeanMax = 1.45f; // rad (~83°)
@@ -79,16 +80,19 @@ public sealed class TrueBodySolver
WristTarget[1] = right * new Vector3(0f, 0f, WristOffset);
// Torso yaw: HMD yaw blended toward the hands when they're out in front (decoupled from the head).
// Facing from BodyMath.HeadFacing: looking down past vertical must not turn the body around.
Vector3 headFwd = -headBasis.Z;
float hmdYaw = Mathf.Atan2(-headFwd.X, -headFwd.Z);
Vector3 flatFwd = BodyMath.HeadFacing(headBasis);
if (flatFwd == Vector3.Zero)
flatFwd = new Basis(Vector3.Up, _yaw) * Vector3.Forward;
float hmdYaw = BodyMath.YawOf(flatFwd);
float targetYaw = hmdYaw;
Vector3 toHands = (WristTarget[0] + WristTarget[1]) * 0.5f - Eye;
toHands.Y = 0f;
Vector3 flatFwd = new Vector3(headFwd.X, 0f, headFwd.Z);
if (toHands.LengthSquared() > 1e-4f && flatFwd.LengthSquared() > 1e-6f)
if (toHands.LengthSquared() > 1e-4f)
{
float handsYaw = Mathf.Atan2(-toHands.X, -toHands.Z);
float forwardness = Mathf.Clamp(toHands.Dot(flatFwd.Normalized()) / YawForwardness, 0f, 1f);
float handsYaw = BodyMath.YawOf(toHands);
float forwardness = Mathf.Clamp(toHands.Dot(flatFwd) / YawForwardness, 0f, 1f);
targetYaw = Mathf.LerpAngle(hmdYaw, handsYaw, forwardness * YawHandsWeight);
}
if (!Initialized)
@@ -102,7 +106,8 @@ public sealed class TrueBodySolver
float pivotAboveFloor = NeckPivot.Y - floorY;
float standingPivot = p.EyeHeight + EyeToNeckPivot.Y;
Crouch = Mathf.Clamp((standingPivot - pivotAboveFloor) / (CrouchRange * p.EyeHeight), 0f, 1f);
float headPitchDown = Mathf.Max(0f, -Mathf.Asin(Mathf.Clamp(headFwd.Y, -1f, 1f)));
// Pitch against the facing, so it keeps growing past vertical (asin peaks at 90°).
float headPitchDown = Mathf.Clamp(Mathf.Atan2(-headFwd.Y, headFwd.Dot(flatFwd)), 0f, MaxHeadPitch);
float lean = Crouch * ChestLeanMax + headPitchDown * HeadPitchToChest;
float trunk = TrunkRatio * p.Stature;
float neckLen = Mathf.Max(0.05f, p.ShoulderDrop + EyeToNeckPivot.Y - NeckBaseAboveShoulders);