diff --git a/src/RustToDust.Ymir/WalkerLocomotion.cs b/src/RustToDust.Ymir/WalkerLocomotion.cs index 803c06c..fcb8ccf 100644 --- a/src/RustToDust.Ymir/WalkerLocomotion.cs +++ b/src/RustToDust.Ymir/WalkerLocomotion.cs @@ -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; diff --git a/tests/RustToDust.Tests/HybridBWalkerTests.cs b/tests/RustToDust.Tests/HybridBWalkerTests.cs index 9017949..b9b09cd 100644 --- a/tests/RustToDust.Tests/HybridBWalkerTests.cs +++ b/tests/RustToDust.Tests/HybridBWalkerTests.cs @@ -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);