mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
Relax walkable slope threshold and floor cache for steep stairs
Changed walkable slope threshold from 0.45 (63°) to 0.40 (66°) in both WMO and M2 collision to allow climbing steeper stairs (like 60° steps). Increased WMO floor cache above-tolerance from 0.35 to 0.50 units to prevent falling through floors in places like Booty Bay where cached floor is slightly above query point.
This commit is contained in:
parent
b51543fdd2
commit
58ec7693a1
2 changed files with 5 additions and 5 deletions
|
|
@ -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.45f);
|
||||
bool isFloor = (absNz >= 0.40f); // ~66° 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.45f) continue; // too steep
|
||||
if (std::abs(worldN.z) < 0.40f) continue; // too steep (~66° max slope)
|
||||
}
|
||||
|
||||
if (hitZ <= localPos.z + 3.0f && hitZ > bestHitZ) {
|
||||
|
|
|
|||
|
|
@ -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.45f);
|
||||
bool isFloor = (absNz >= 0.40f); // ~66° 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));
|
||||
|
|
@ -1750,7 +1750,7 @@ std::optional<float> WMORenderer::getFloorHeight(float glX, float glY, float glZ
|
|||
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.35f; // tune: 0.25–0.60
|
||||
constexpr float CACHE_ABOVE = 0.50f; // tune: 0.25–0.60 (increased to catch borderline floors)
|
||||
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.45f) continue;
|
||||
if (absNz >= 0.40f) 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