wip(ymir): WIP pre-reboot checkpoint (42/43 focused pass)
This commit is contained in:
parent
0e8985e0ac
commit
47b9dd85cd
1 changed files with 16 additions and 9 deletions
|
|
@ -1465,7 +1465,7 @@ namespace RustToDust.Ymir
|
||||||
float minDur = scale < 0.70f ? 0.085f : Math.Clamp(0.24f * MathF.Sqrt(hScale), 0.23f, 0.34f);
|
float minDur = scale < 0.70f ? 0.085f : Math.Clamp(0.24f * MathF.Sqrt(hScale), 0.23f, 0.34f);
|
||||||
float effectiveDur = baseDur * (1f - 0.28f * speedFrac);
|
float effectiveDur = baseDur * (1f - 0.28f * speedFrac);
|
||||||
float crouchFrac = n == 2 ? Math.Clamp(horizSpeed / MathF.Max(6f, grid.Spec.MaxSpeed * 0.42f), 0f, 1f) : speedFrac;
|
float crouchFrac = n == 2 ? Math.Clamp(horizSpeed / MathF.Max(6f, grid.Spec.MaxSpeed * 0.42f), 0f, 1f) : speedFrac;
|
||||||
float crouchCoeff = geom.ModelHalfHeight < 3.20f ? 0.115f : 0.055f;
|
float crouchCoeff = geom.Id == "breaker" ? 0.130f : (geom.Id == "kestrel" ? 0.095f : 0.055f);
|
||||||
float crouchBias = n == 2 ? crouchCoeff * geom.ModelHalfHeight * scale * crouchFrac : 0f;
|
float crouchBias = n == 2 ? crouchCoeff * geom.ModelHalfHeight * scale * crouchFrac : 0f;
|
||||||
|
|
||||||
// Bound step duration so stance travel stays inside physical horizontal reach at sprint speed
|
// Bound step duration so stance travel stays inside physical horizontal reach at sprint speed
|
||||||
|
|
@ -1585,7 +1585,7 @@ namespace RustToDust.Ymir
|
||||||
|
|
||||||
// Heel-strike knee compression dip scaled by mass and gait speed
|
// Heel-strike knee compression dip scaled by mass and gait speed
|
||||||
float massScale = MathF.Sqrt(MathF.Max(800f, mass) / 2600f);
|
float massScale = MathF.Sqrt(MathF.Max(800f, mass) / 2600f);
|
||||||
ws.CompressionVelY -= 1.50f * massScale * (0.45f + 0.55f * speedFrac);
|
ws.CompressionVelY -= 2.30f * massScale * (0.45f + 0.55f * speedFrac);
|
||||||
|
|
||||||
ws.StanceGroup = 1 - ws.StanceGroup;
|
ws.StanceGroup = 1 - ws.StanceGroup;
|
||||||
ws.SwingTime = 0f;
|
ws.SwingTime = 0f;
|
||||||
|
|
@ -1758,17 +1758,17 @@ namespace RustToDust.Ymir
|
||||||
|
|
||||||
float sprintCrouchFrac = Math.Clamp(horizSpeed / MathF.Max(6f, grid.Spec.MaxSpeed * 0.42f), 0f, 1f);
|
float sprintCrouchFrac = Math.Clamp(horizSpeed / MathF.Max(6f, grid.Spec.MaxSpeed * 0.42f), 0f, 1f);
|
||||||
bool isCompactBiped = geom.ModelHalfHeight < 3.20f;
|
bool isCompactBiped = geom.ModelHalfHeight < 3.20f;
|
||||||
float sprintCrouchCoeff = isCompactBiped ? 0.115f : 0.055f;
|
float sprintCrouchCoeff = geom.Id == "breaker" ? 0.130f : (geom.Id == "kestrel" ? 0.095f : 0.055f);
|
||||||
float sprintCrouchY = -sprintCrouchCoeff * geom.ModelHalfHeight * scale * sprintCrouchFrac;
|
float sprintCrouchY = -sprintCrouchCoeff * geom.ModelHalfHeight * scale * sprintCrouchFrac;
|
||||||
float vaultAmp = (isCompactBiped ? 0.11f : 0.09f) * scale * (0.35f + 0.65f * speedFrac);
|
float vaultAmp = (isCompactBiped ? 0.145f : 0.125f) * scale * (0.35f + 0.65f * speedFrac);
|
||||||
float vaultY = (isCompactBiped ? (swingSin - 0.35f) : swingSin) * vaultAmp;
|
float vaultY = (isCompactBiped ? (swingSin - 0.25f) : swingSin) * vaultAmp;
|
||||||
targetPelvis = new Vector3(targetPelvisX, sprintCrouchY + vaultY + ws.CompressionY, 0f);
|
targetPelvis = new Vector3(targetPelvisX, sprintCrouchY + vaultY + ws.CompressionY, 0f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
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.06f * 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 polyAdjY = Math.Clamp(meanSoleY - centerG.SurfaceY, minPolyAdj, 0.40f * scale);
|
||||||
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);
|
||||||
|
|
@ -1895,7 +1895,7 @@ namespace RustToDust.Ymir
|
||||||
float maxComY = ankle.Y - hipOff.Y + remYMax;
|
float maxComY = ankle.Y - hipOff.Y + remYMax;
|
||||||
maxAllowedPelvisY = MathF.Min(maxAllowedPelvisY, maxComY - comPos.Y);
|
maxAllowedPelvisY = MathF.Min(maxAllowedPelvisY, maxComY - comPos.Y);
|
||||||
|
|
||||||
float minR = geom.Legs[i].MinLegReach * scale * (n == 4 ? 1.15f : 1.02f);
|
float minR = geom.Legs[i].MinLegReach * scale * (geom.IsArachnidUp ? 1.15f : 1.02f);
|
||||||
float remYMin = MathF.Sqrt(MathF.Max(0f, minR * minR - hSq));
|
float remYMin = MathF.Sqrt(MathF.Max(0f, minR * minR - hSq));
|
||||||
float minComY = ankle.Y - hipOff.Y + remYMin;
|
float minComY = ankle.Y - hipOff.Y + remYMin;
|
||||||
minAllowedPelvisY = MathF.Max(minAllowedPelvisY, minComY - comPos.Y);
|
minAllowedPelvisY = MathF.Max(minAllowedPelvisY, minComY - comPos.Y);
|
||||||
|
|
@ -1907,9 +1907,16 @@ namespace RustToDust.Ymir
|
||||||
float clampedPelvisY = Math.Clamp(ws.PelvisOffset.Y, minAllowedPelvisY, maxAllowedPelvisY);
|
float clampedPelvisY = Math.Clamp(ws.PelvisOffset.Y, minAllowedPelvisY, maxAllowedPelvisY);
|
||||||
if (clampedPelvisY < ws.PelvisOffset.Y)
|
if (clampedPelvisY < ws.PelvisOffset.Y)
|
||||||
{
|
{
|
||||||
float maxDropPerTick = 2.8f * scale * dt;
|
if (n == 4)
|
||||||
|
{
|
||||||
|
float maxDropPerTick = (geom.IsArachnidUp ? 2.8f : 8.0f) * scale * dt;
|
||||||
ws.PelvisOffset.Y = MathF.Max(clampedPelvisY, ws.PelvisOffset.Y - maxDropPerTick);
|
ws.PelvisOffset.Y = MathF.Max(clampedPelvisY, ws.PelvisOffset.Y - maxDropPerTick);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ws.PelvisOffset.Y = MathF.Max(-0.85f * scale, clampedPelvisY);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (clampedPelvisY > ws.PelvisOffset.Y)
|
else if (clampedPelvisY > ws.PelvisOffset.Y)
|
||||||
{
|
{
|
||||||
float maxRisePerTick = 2.8f * scale * dt;
|
float maxRisePerTick = 2.8f * scale * dt;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue