mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 17:43:52 +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) {
|
if (wmoRenderer) {
|
||||||
glm::vec3 adjusted;
|
glm::vec3 adjusted;
|
||||||
if (wmoRenderer->checkWallCollision(stepPos, candidate, adjusted)) {
|
if (wmoRenderer->checkWallCollision(stepPos, candidate, adjusted)) {
|
||||||
candidate.x = adjusted.x;
|
// Before blocking, check if there's a floor at the
|
||||||
candidate.y = adjusted.y;
|
// 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;
|
wasJumping = nowJump;
|
||||||
wasFalling = !grounded && verticalVelocity <= 0.0f;
|
wasFalling = !grounded && verticalVelocity <= 0.0f;
|
||||||
|
|
||||||
// Reset camera/character (R key, edge-triggered)
|
// R key disabled — was camera reset, conflicts with chat reply
|
||||||
bool rDown = !uiWantsKeyboard && input.isKeyPressed(SDL_SCANCODE_R);
|
rKeyWasDown = false;
|
||||||
if (rDown && !rKeyWasDown) {
|
|
||||||
reset();
|
|
||||||
}
|
|
||||||
rKeyWasDown = rDown;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CameraController::processMouseMotion(const SDL_MouseMotionEvent& event) {
|
void CameraController::processMouseMotion(const SDL_MouseMotionEvent& event) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue