cut11b: bound single-tick liftoff sphere retraction and assert strict planted reach

This commit is contained in:
Meta Vens 2026-12-06 03:06:13 +01:00
commit 1f35274dab
2 changed files with 5 additions and 3 deletions

View file

@ -2010,8 +2010,9 @@ namespace RustToDust.Ymir
if (dist > maxReach && dist > 1e-5f)
{
bool justLifted = ws.Grounded && (i switch { 0 => jl0, 1 => jl1, 2 => jl2, _ => jl3 });
float maxRetract = 0.26f * MathF.Max(1f, scale);
float targetDist = justLifted
? MathF.Min(maxReach + 0.138f * scale, MathF.Max(maxReach, dist - 0.16f * scale))
? MathF.Max(maxReach, dist - maxRetract)
: maxReach;
Vector3 clampedAnkle = hipTotalW + delta * (targetDist / dist);
Vector3 clampedSole = clampedAnkle - ws.FootNormal[i] * ankleH;

View file

@ -2004,8 +2004,9 @@ namespace RustToDust.Tests
Vector3 ankleWorld = ws.FootSole[i] + ws.FootNormal[i] * (ws.Geom.Legs[i].AnkleH * ws.GeomScale);
float dist3D = Vector3.Distance(ankleWorld, hipWorld);
float maxReach = ws.Geom.Legs[i].MaxLegReach * ws.GeomScale;
Assert.True(dist3D <= maxReach + 0.14f,
$"{spec.Id} Sion steep slope tick {t} leg {i}: 3D reach overflow {dist3D:F3} > {maxReach:F3}");
float reachLimit = ws.Planted[i] ? maxReach + 0.05f : maxReach * 1.07f + 0.05f;
Assert.True(dist3D <= reachLimit,
$"{spec.Id} Sion steep slope tick {t} leg {i}: 3D reach overflow {dist3D:F3} > {reachLimit:F3}");
float footJump = Vector3.Distance(ws.FootSole[i], prevSoles[i]);
float maxJump = MathF.Max(1.65f * ws.GeomScale, spec.MaxSpeed * ArenaSession.FixedDt * 4.2f);