cut11b: rate-limit liftoff reach retraction and restore minBreakTime
This commit is contained in:
parent
49a5df2fb9
commit
9c283a1962
1 changed files with 8 additions and 5 deletions
|
|
@ -1484,8 +1484,7 @@ namespace RustToDust.Ymir
|
|||
|
||||
// Early step-completion break if a planted leg reaches > effectiveBreakFrac * MaxLegReach
|
||||
bool earlyBreak = false;
|
||||
float reachBreakTime = 0.72f * geom.MaxStepRadius * scale / MathF.Max(4f, horizSpeed);
|
||||
float minBreakTime = Math.Clamp(MathF.Min(minDur * (ws.FirstStepFromIdle ? 0.68f : 0.90f), reachBreakTime), 0.060f, 0.22f);
|
||||
float minBreakTime = Math.Clamp(minDur * (ws.FirstStepFromIdle ? 0.68f : 0.90f), 0.075f, 0.22f);
|
||||
if (ws.SwingTime >= minBreakTime && ws.SwingPhase > overlap + 0.15f)
|
||||
{
|
||||
Vector3 curPelvisShift = Vector3.Transform(ws.PelvisOffset, qYaw);
|
||||
|
|
@ -1980,7 +1979,11 @@ namespace RustToDust.Ymir
|
|||
float dist = delta.Length();
|
||||
if (dist > maxReach && dist > 1e-5f)
|
||||
{
|
||||
Vector3 clampedAnkle = hipTotalW + delta * (maxReach / dist);
|
||||
bool justLifted = ws.Grounded && (i switch { 0 => jl0, 1 => jl1, 2 => jl2, _ => jl3 });
|
||||
float targetDist = justLifted
|
||||
? MathF.Max(maxReach, dist - 0.16f * scale)
|
||||
: maxReach;
|
||||
Vector3 clampedAnkle = hipTotalW + delta * (targetDist / dist);
|
||||
Vector3 clampedSole = clampedAnkle - ws.FootNormal[i] * ankleH;
|
||||
var under = SampleGroundAt(terrain, world, clampedSole.X, clampedSole.Z, comPos.Y + 0.8f);
|
||||
if (clampedSole.Y < under.SurfaceY)
|
||||
|
|
@ -1988,9 +1991,9 @@ namespace RustToDust.Ymir
|
|||
clampedSole.Y = under.SurfaceY;
|
||||
Vector3 cd = (clampedSole + under.Normal * ankleH) - hipTotalW;
|
||||
float cdLen = cd.Length();
|
||||
if (cdLen > maxReach && cdLen > 1e-5f)
|
||||
if (cdLen > targetDist && cdLen > 1e-5f)
|
||||
{
|
||||
clampedSole = (hipTotalW + cd * (maxReach / cdLen)) - under.Normal * ankleH;
|
||||
clampedSole = (hipTotalW + cd * (targetDist / cdLen)) - under.Normal * ankleH;
|
||||
}
|
||||
}
|
||||
ws.FootSole[i] = clampedSole;
|
||||
|
|
|
|||
Loading…
Reference in a new issue