fix(ymir): keep walker grounded across 45 deg dune crests and fine-step uphill ClampSoleToReach
This commit is contained in:
parent
7834662082
commit
889ec9f1f8
1 changed files with 6 additions and 5 deletions
|
|
@ -156,7 +156,7 @@ namespace RustToDust.Ymir
|
|||
float rideH = Geom.ModelRideHeight * GeomScale;
|
||||
var centerHit = WalkerLocomotion.SampleGroundAt(terrain, world, comPos.X, comPos.Z, comPos.Y + 0.5f, 0.25f);
|
||||
float bottomClearance = (comPos.Y - rideH) - centerHit.SurfaceY;
|
||||
Grounded = centerHit.Hit && centerHit.Normal.Y >= MaxWalkableNormalY && bottomClearance <= 0.18f;
|
||||
Grounded = centerHit.Hit && centerHit.Normal.Y >= MaxCliffGuardNormalY && bottomClearance <= 0.18f;
|
||||
WasGrounded = Grounded;
|
||||
IsAirborne = !Grounded;
|
||||
WasAirborne = IsAirborne;
|
||||
|
|
@ -1187,13 +1187,14 @@ namespace RustToDust.Ymir
|
|||
: Vector3.UnitY;
|
||||
|
||||
float gTerrCenterY = gTerrY + halfLength + radius * Math.Clamp(1f / MathF.Max(0.45f, gTerrN.Y), 1f, 1.25f);
|
||||
float groundMinNy = ws.WasGrounded ? 0.642788f : WalkerState.MaxCliffGuardNormalY; // keep grounded across brief 45-50 deg dune ripples while still gating cliffs
|
||||
bool terrGround = !terrain.IsHeightmapMode &&
|
||||
gTerrN.Y >= WalkerState.MaxCliffGuardNormalY &&
|
||||
gTerrN.Y >= groundMinNy &&
|
||||
pos.Y <= gTerrCenterY + 0.18f;
|
||||
if (staticIsHeightfield && gTerrY < pos.Y - physHalfH - 0.05f)
|
||||
{
|
||||
staticGround = false;
|
||||
terrGround = gTerrN.Y >= WalkerState.MaxCliffGuardNormalY && pos.Y <= gTerrCenterY + 0.18f;
|
||||
terrGround = gTerrN.Y >= groundMinNy && pos.Y <= gTerrCenterY + 0.18f;
|
||||
}
|
||||
|
||||
ws.Grounded = (steppedThisTick || staticGround || terrGround) &&
|
||||
|
|
@ -2102,9 +2103,9 @@ namespace RustToDust.Ymir
|
|||
float spanLen = fromSoleToCenter.Length();
|
||||
if (spanLen > 1e-3f)
|
||||
{
|
||||
for (int s = 1; s <= 5; s++)
|
||||
for (int s = 1; s <= 10; s++)
|
||||
{
|
||||
float t = s * 0.25f;
|
||||
float t = s * 0.125f;
|
||||
float sx = fx + fromSoleToCenter.X * t;
|
||||
float sz = fz + fromSoleToCenter.Y * t;
|
||||
var sh = SampleGroundAt(terrain, world, sx, sz, referenceMaxY);
|
||||
|
|
|
|||
Loading…
Reference in a new issue