mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
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:
parent
58ec7693a1
commit
dbadfb043b
3 changed files with 14 additions and 10 deletions
|
|
@ -1607,7 +1607,7 @@ void WMORenderer::GroupResources::buildCollisionGrid() {
|
|||
glm::vec3 normal = glm::cross(edge1, edge2);
|
||||
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); // Matches walkable slope threshold
|
||||
|
||||
int cellMinX = std::max(0, static_cast<int>((triMinX - gridOrigin.x) * invCellW));
|
||||
|
|
@ -1749,8 +1749,8 @@ std::optional<float> WMORenderer::getFloorHeight(float glX, float glY, float glZ
|
|||
if (gridIt != precomputedFloorGrid.end()) {
|
||||
float cachedHeight = gridIt->second;
|
||||
// Only trust cache if it's basically at foot level.
|
||||
// Prevent ledges/shoulder ramps from being treated as "floor".
|
||||
constexpr float CACHE_ABOVE = 0.50f; // tune: 0.25–0.60 (increased to catch borderline floors)
|
||||
// Reject cache if it's too high above us (prevents stair landing from overriding approach floor)
|
||||
constexpr float CACHE_ABOVE = 0.25f; // tight above threshold (prevents stair landing cache hit)
|
||||
constexpr float CACHE_BELOW = 4.0f; // keep generous below
|
||||
if (cachedHeight <= glZ + CACHE_ABOVE && cachedHeight >= glZ - CACHE_BELOW) {
|
||||
// Persistent cache doesn't store normal — report as flat
|
||||
|
|
@ -2066,7 +2066,7 @@ bool WMORenderer::checkWallCollision(const glm::vec3& from, const glm::vec3& to,
|
|||
if (horizDist <= PLAYER_RADIUS) {
|
||||
// Skip floor-like surfaces — grounding handles them, not wall collision
|
||||
float absNz = std::abs(normal.z);
|
||||
if (absNz >= 0.40f) continue;
|
||||
if (absNz >= 0.35f) continue;
|
||||
|
||||
const float SKIN = 0.005f; // small separation so we don't re-collide immediately
|
||||
// Stronger push when inside WMO for more responsive indoor collision
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue