mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 15:50:20 +00:00
Improve stair climbing and disable R hotkey
Skip wall collision when a walkable floor exists above current feet, allowing smooth stair traversal without per-zone tuning. Disable R key camera reset to avoid conflicts with chat.
This commit is contained in:
parent
a01cec68a4
commit
2b771ec92e
1 changed files with 15 additions and 8 deletions
|
|
@ -453,8 +453,19 @@ void CameraController::update(float deltaTime) {
|
|||
if (wmoRenderer) {
|
||||
glm::vec3 adjusted;
|
||||
if (wmoRenderer->checkWallCollision(stepPos, candidate, adjusted)) {
|
||||
candidate.x = adjusted.x;
|
||||
candidate.y = adjusted.y;
|
||||
// Before blocking, check if there's a floor at the
|
||||
// destination above current feet (stair step-up).
|
||||
float feetZ = stepPos.z;
|
||||
float probeZ = feetZ + 2.5f;
|
||||
auto floorH = wmoRenderer->getFloorHeight(
|
||||
candidate.x, candidate.y, probeZ);
|
||||
bool isStair = floorH &&
|
||||
*floorH > feetZ + 0.1f &&
|
||||
*floorH <= feetZ + 1.6f;
|
||||
if (!isStair) {
|
||||
candidate.x = adjusted.x;
|
||||
candidate.y = adjusted.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -992,12 +1003,8 @@ void CameraController::update(float deltaTime) {
|
|||
wasJumping = nowJump;
|
||||
wasFalling = !grounded && verticalVelocity <= 0.0f;
|
||||
|
||||
// Reset camera/character (R key, edge-triggered)
|
||||
bool rDown = !uiWantsKeyboard && input.isKeyPressed(SDL_SCANCODE_R);
|
||||
if (rDown && !rKeyWasDown) {
|
||||
reset();
|
||||
}
|
||||
rKeyWasDown = rDown;
|
||||
// R key disabled — was camera reset, conflicts with chat reply
|
||||
rKeyWasDown = false;
|
||||
}
|
||||
|
||||
void CameraController::processMouseMotion(const SDL_MouseMotionEvent& event) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue