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

@ -718,7 +718,7 @@ void M2ModelGPU::CollisionMesh::build() {
glm::vec3 normal = glm::cross(v1 - v0, v2 - v0);
float normalLen = glm::length(normal);
float absNz = (normalLen > 0.001f) ? std::abs(normal.z / normalLen) : 0.0f;
bool isFloor = (absNz >= 0.40f); // ~66° max slope (relaxed for steep stairs)
bool isFloor = (absNz >= 0.35f); // ~70° max slope (relaxed for steep stairs)
bool isWall = (absNz < 0.65f);
float triMinX = std::min({v0.x, v1.x, v2.x});
@ -2573,7 +2573,7 @@ std::optional<float> M2Renderer::getFloorHeight(float glX, float glY, float glZ)
if (localN.z < 0.0f) localN = -localN;
glm::vec3 worldN = glm::normalize(
glm::vec3(instance.modelMatrix * glm::vec4(localN, 0.0f)));
if (std::abs(worldN.z) < 0.40f) continue; // too steep (~66° max slope)
if (std::abs(worldN.z) < 0.35f) continue; // too steep (~70° max slope)
}
if (hitZ <= localPos.z + 3.0f && hitZ > bestHitZ) {