fix(ymir): bound bastion maxPolyAdj within front-leg vertical reach

This commit is contained in:
Meta Vens 2026-12-06 00:59:23 +01:00
commit 3510b5ebcd

View file

@ -1769,7 +1769,8 @@ namespace RustToDust.Ymir
float meanSoleY = 0.25f * (ws.FootSole[0].Y + ws.FootSole[1].Y + ws.FootSole[2].Y + ws.FootSole[3].Y); float meanSoleY = 0.25f * (ws.FootSole[0].Y + ws.FootSole[1].Y + ws.FootSole[2].Y + ws.FootSole[3].Y);
var centerG = SampleGroundAt(terrain, world, comPos.X, comPos.Z, comPos.Y + 0.6f); var centerG = SampleGroundAt(terrain, world, comPos.X, comPos.Z, comPos.Y + 0.6f);
float minPolyAdj = !geom.IsArachnidUp ? -0.25f * scale : -0.35f * scale; float minPolyAdj = !geom.IsArachnidUp ? -0.25f * scale : -0.35f * scale;
float polyAdjY = Math.Clamp(meanSoleY - centerG.SurfaceY, minPolyAdj, 0.40f * scale); float maxPolyAdj = !geom.IsArachnidUp ? 0.12f * scale : 0.40f * scale;
float polyAdjY = Math.Clamp(meanSoleY - centerG.SurfaceY, minPolyAdj, maxPolyAdj);
float diagSignX = (ws.Planted[0] && !ws.Planted[1]) ? +1f : ((!ws.Planted[0] && ws.Planted[1]) ? -1f : 0f); float diagSignX = (ws.Planted[0] && !ws.Planted[1]) ? +1f : ((!ws.Planted[0] && ws.Planted[1]) ? -1f : 0f);
float latShiftX = diagSignX * 0.08f * scale * swingSin * Math.Clamp(horizSpeed / 6.0f, 0.25f, 1f); float latShiftX = diagSignX * 0.08f * scale * swingSin * Math.Clamp(horizSpeed / 6.0f, 0.25f, 1f);
float baseLift = !geom.IsArachnidUp ? 0.02f * scale : 0.04f * scale; float baseLift = !geom.IsArachnidUp ? 0.02f * scale : 0.04f * scale;