Fix stair approach fall-through and relax steep slope climbing

Relaxed walkable slope threshold from 0.40 to 0.35 (~70° max) for
steeper stair climbing. Tightened WMO floor cache above-tolerance
back to 0.25 units to prevent cached stair landing from overriding
approach floor. Added M2 floor preference for ship decks to prevent
falling through to water below.
This commit is contained in:
Kelsi 2026-02-08 20:31:00 -08:00
parent 58ec7693a1
commit dbadfb043b
3 changed files with 14 additions and 10 deletions

View file

@ -506,7 +506,7 @@ void CameraController::update(float deltaTime) {
groundH = selectReachableFloor(terrainH, wmoH, targetPos.z, stepUpBudget);
}
// 2. Multi-sample for M2 objects (rugs, planks, bridges) —
// 2. Multi-sample for M2 objects (rugs, planks, bridges, ships) —
// these are narrow and need offset probes to detect reliably.
if (m2Renderer) {
constexpr float FOOTPRINT = 0.4f;
@ -519,9 +519,13 @@ void CameraController::update(float deltaTime) {
for (const auto& o : offsets) {
auto m2H = m2Renderer->getFloorHeight(
targetPos.x + o.x, targetPos.y + o.y, m2ProbeZ);
if (m2H && *m2H <= targetPos.z + stepUpBudget &&
(!groundH || *m2H > *groundH)) {
groundH = m2H;
// Prefer M2 floors (ships, platforms) even if slightly lower than terrain
// to prevent falling through ship decks to water below
if (m2H && *m2H <= targetPos.z + stepUpBudget) {
if (!groundH || *m2H > *groundH ||
(*m2H >= targetPos.z - 0.5f && *groundH < targetPos.z - 1.0f)) {
groundH = m2H;
}
}
}
}