mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 17:43:52 +00:00
Tune wall collision for stairs and reduce camera distance in WMOs
Skip short vertical surfaces (stair risers) to allow climbing stairs. Reduce WMO interior max camera zoom to 8 units and soften wall pushback.
This commit is contained in:
parent
8a9a2c6d3d
commit
b3552e4e65
2 changed files with 6 additions and 3 deletions
|
|
@ -615,7 +615,7 @@ void CameraController::update(float deltaTime) {
|
||||||
currentDistance += (userTargetDistance - currentDistance) * zoomLerp;
|
currentDistance += (userTargetDistance - currentDistance) * zoomLerp;
|
||||||
|
|
||||||
// Limit max zoom when inside a WMO (building interior)
|
// Limit max zoom when inside a WMO (building interior)
|
||||||
static constexpr float WMO_MAX_DISTANCE = 15.0f;
|
static constexpr float WMO_MAX_DISTANCE = 8.0f;
|
||||||
if (wmoRenderer && wmoRenderer->isInsideWMO(targetPos.x, targetPos.y, targetPos.z + 1.0f, nullptr)) {
|
if (wmoRenderer && wmoRenderer->isInsideWMO(targetPos.x, targetPos.y, targetPos.z + 1.0f, nullptr)) {
|
||||||
if (currentDistance > WMO_MAX_DISTANCE) {
|
if (currentDistance > WMO_MAX_DISTANCE) {
|
||||||
currentDistance = WMO_MAX_DISTANCE;
|
currentDistance = WMO_MAX_DISTANCE;
|
||||||
|
|
|
||||||
|
|
@ -1517,7 +1517,7 @@ bool WMORenderer::checkWallCollision(const glm::vec3& from, const glm::vec3& to,
|
||||||
// Player collision parameters
|
// Player collision parameters
|
||||||
const float PLAYER_RADIUS = 0.70f; // Wider radius for better wall collision
|
const float PLAYER_RADIUS = 0.70f; // Wider radius for better wall collision
|
||||||
const float PLAYER_HEIGHT = 2.0f; // Player height for wall checks
|
const float PLAYER_HEIGHT = 2.0f; // Player height for wall checks
|
||||||
const float MAX_STEP_HEIGHT = 0.70f; // Lower step height to catch more walls
|
const float MAX_STEP_HEIGHT = 1.0f; // Allow stepping up stairs
|
||||||
|
|
||||||
// Debug logging
|
// Debug logging
|
||||||
static int wallDebugCounter = 0;
|
static int wallDebugCounter = 0;
|
||||||
|
|
@ -1607,6 +1607,9 @@ bool WMORenderer::checkWallCollision(const glm::vec3& from, const glm::vec3& to,
|
||||||
// Skip ramp surfaces (facing mostly upward) that are low
|
// Skip ramp surfaces (facing mostly upward) that are low
|
||||||
if (normal.z > 0.50f && triMaxZ <= localFeetZ + 1.2f) continue;
|
if (normal.z > 0.50f && triMaxZ <= localFeetZ + 1.2f) continue;
|
||||||
|
|
||||||
|
// Skip short vertical surfaces (stair risers) - real walls are tall
|
||||||
|
if (triHeight < 1.2f && triMaxZ <= localFeetZ + 1.5f) continue;
|
||||||
|
|
||||||
// Swept test: prevent tunneling when crossing a wall between frames.
|
// Swept test: prevent tunneling when crossing a wall between frames.
|
||||||
if ((fromDist > PLAYER_RADIUS && toDist < -PLAYER_RADIUS) ||
|
if ((fromDist > PLAYER_RADIUS && toDist < -PLAYER_RADIUS) ||
|
||||||
(fromDist < -PLAYER_RADIUS && toDist > PLAYER_RADIUS)) {
|
(fromDist < -PLAYER_RADIUS && toDist > PLAYER_RADIUS)) {
|
||||||
|
|
@ -1636,7 +1639,7 @@ bool WMORenderer::checkWallCollision(const glm::vec3& from, const glm::vec3& to,
|
||||||
float horizDist = glm::length(glm::vec2(delta.x, delta.y));
|
float horizDist = glm::length(glm::vec2(delta.x, delta.y));
|
||||||
if (horizDist <= PLAYER_RADIUS) {
|
if (horizDist <= PLAYER_RADIUS) {
|
||||||
wallsHit++;
|
wallsHit++;
|
||||||
float pushDist = PLAYER_RADIUS - horizDist + 0.08f; // More aggressive pushback
|
float pushDist = PLAYER_RADIUS - horizDist + 0.04f;
|
||||||
glm::vec2 pushDir2;
|
glm::vec2 pushDir2;
|
||||||
if (horizDist > 1e-4f) {
|
if (horizDist > 1e-4f) {
|
||||||
pushDir2 = glm::normalize(glm::vec2(delta.x, delta.y));
|
pushDir2 = glm::normalize(glm::vec2(delta.x, delta.y));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue