From 76584473d47bf635d9dc90d4707622d8d94c7de1 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 4 Dec 2026 15:17:52 +0100 Subject: [PATCH] Add center skid-plate bump-stop to terrain support for sharp ridge crests --- src/RustToDust.Ymir/ArenaSession.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/RustToDust.Ymir/ArenaSession.cs b/src/RustToDust.Ymir/ArenaSession.cs index e813350..6c9afff 100644 --- a/src/RustToDust.Ymir/ArenaSession.cs +++ b/src/RustToDust.Ymir/ArenaSession.cs @@ -551,9 +551,9 @@ namespace RustToDust.Ymir float hx = spec.HalfWidth * 0.9f; float hz = spec.HalfLength * 0.9f; float bottomY = -spec.HalfHeight; - const float restTravel = 0.18f; - float kSpring = mass * 75f; - float cDamp = mass * 9.5f; + const float restTravel = 0.20f; + float kSpring = mass * 85f; + float cDamp = mass * 10.5f; Span corners = stackalloc Vector3[4] { @@ -579,6 +579,14 @@ namespace RustToDust.Ymir } } + // Center skid-plate bump-stop prevents belly clipping when straddling sharp ridge crests at speed + float centerPen = (State.Terrain.SampleHeight(pos.X, pos.Z) + 0.08f) - (pos.Y - spec.HalfHeight); + if (centerPen > 0f) + { + groundedCorners = Math.Max(groundedCorners, 1); + supportForce.Y += Math.Clamp(mass * 160f * centerPen - mass * 12f * vel.Y, 0f, mass * 140f); + } + var (nx, ny, nz) = State.Terrain.SampleNormal(pos.X, pos.Z); terrainNormal = new Vector3(nx, ny, nz); }