fix(ymir): damp downhill 3D jump on quad earlyBreak plant

This commit is contained in:
Meta Vens 2026-12-06 01:05:49 +01:00
commit 6802868912

View file

@ -1521,7 +1521,7 @@ namespace RustToDust.Ymir
if (!IsInGroup(n, i, ws.StanceGroup))
{
Vector3 plantSource = ws.SwingTargetSole[i];
float maxPlantStep = MathF.Max(0.85f * scale, horizSpeed * dt * 2.2f);
float maxPlantStep = MathF.Max(1.15f * scale, horizSpeed * dt * 2.2f);
bool earlyQuadClamp = earlyBreak && !(n == 2 && scale >= 0.70f);
if (earlyBreak)
{
@ -1577,6 +1577,23 @@ namespace RustToDust.Ymir
}
}
}
if (earlyQuadClamp && (landedSole - ws.FootSole[i]).Length() > 1.45f * scale)
{
float midX = 0.5f * (ws.FootSole[i].X + landedSole.X);
float midZ = 0.5f * (ws.FootSole[i].Z + landedSole.Z);
var midHit = SampleGroundAt(terrain, world, midX, midZ, comPos.Y + 0.8f);
Vector3 midSole = new(midX, midHit.SurfaceY, midZ);
Vector3 midNorm = midHit.Normal;
if (ClampSoleToReach(plantHip, plantAnkleH, plantMaxReach, terrain, world, comPos.Y + 0.8f, ref midSole, out Vector3 midClampedN))
{
midNorm = midClampedN;
}
if ((midSole - ws.FootSole[i]).Length() < (landedSole - ws.FootSole[i]).Length())
{
landedSole = midSole;
landedNorm = midNorm;
}
}
ws.FootSole[i] = landedSole;
ws.FootNormal[i] = landedNorm;
ws.Planted[i] = true;