cut11b: unify quad idle break, early plant step cap, and cliff hover preservation

This commit is contained in:
Meta Vens 2026-12-06 02:47:20 +01:00
commit f69d8fdc73

View file

@ -1484,7 +1484,8 @@ namespace RustToDust.Ymir
// Early step-completion break if a planted leg reaches > effectiveBreakFrac * MaxLegReach
bool earlyBreak = false;
float minBreakTime = Math.Clamp(minDur * (ws.FirstStepFromIdle ? 0.38f : 0.90f), 0.075f, 0.22f);
float firstIdleRatio = n == 4 ? 0.32f : 0.68f;
float minBreakTime = Math.Clamp(minDur * (ws.FirstStepFromIdle ? firstIdleRatio : 0.90f), 0.075f, 0.22f);
if (ws.SwingTime >= minBreakTime && ws.SwingPhase > overlap + 0.15f)
{
Vector3 curPelvisShift = Vector3.Transform(ws.PelvisOffset, qYaw);
@ -1525,7 +1526,7 @@ namespace RustToDust.Ymir
if (!IsInGroup(n, i, ws.StanceGroup))
{
Vector3 plantSource = ws.SwingTargetSole[i];
float maxPlantStep = MathF.Max(1.15f * scale, horizSpeed * dt * 2.2f);
float maxPlantStep = MathF.Max(1.00f * scale, horizSpeed * dt * 2.0f);
if (earlyBreak && ws.SwingPhase < 0.96f)
{
Vector3 stepVec = ws.SwingTargetSole[i] - ws.FootSole[i];
@ -1590,13 +1591,7 @@ namespace RustToDust.Ymir
}
else
{
// Foot hovers over a cliff drop-off: keep sole continuous instead of snapping 6m down the cliff
Vector3 stepD = candSole[i] - ws.FootSole[i];
float stepLen = stepD.Length();
float maxHoverStep = MathF.Max(1.15f * scale, horizSpeed * dt * 2.5f);
ws.FootSole[i] = stepLen > maxHoverStep && stepLen > 1e-5f
? ws.FootSole[i] + stepD * (maxHoverStep / stepLen)
: candSole[i];
// Foot hovers over a cliff drop-off: preserve current sole so 3D reach clamp adjusts smoothly without double-stepping
ws.FootNormal[i] = candNorm[i];
ws.Planted[i] = false;
}