Crouch toggle (Shift+C) doesn't toggle crouch #438

Closed
opened 2026-10-05 13:44:57 +00:00 by sky_line · 0 comments
Owner

Symptom: Shift+C (the default "Toggle crouch" key) doesn't toggle crouch. The avatar ducks for a frame at most and then stands back up.

Root cause (found in code):

  • The key binding is fine: app_settings/key_bindings.xml maps C + SHIFT to toggle_down.
  • The handler is fine: agent_toggle_down (llviewerinput.cpp:123) flips LLAgent::mCrouch and sends one moveUp(-1).
  • What's missing is the per-frame sustain. The crouch only holds if AGENT_CONTROL_UP_NEG is sent every frame while mCrouch is set. The original Alchemy code (b3bc362f6e) did this in the main loop in llappviewer.cpp, right after input scanning:
    gKeyboard->scanKeyboard();
    gViewerInput.scanMouse();
    if (gAgent.isCrouching())
        gAgent.moveUp(-1);
    
    When Rye restored the crouch toggle (a8b8f2ef4d), the binding, handler and mCrouch state came back but this block didn't. LLAgent::isCrouching() now has no callers anywhere.

Fix:

  • Re-add the sustain after the scan in the main loop.
  • Check that moveUp(-1) called every frame doesn't fight the camera. It skips resetView while mCrouch is set, so it should be fine.
  • Check that flying, jumping (which clears mCrouch), sitting and RLV still behave. While sitting, UP_NEG may need gating so it doesn't stand the avatar up or steer a vehicle.
**Symptom:** Shift+C (the default "Toggle crouch" key) doesn't toggle crouch. The avatar ducks for a frame at most and then stands back up. **Root cause (found in code):** - The key binding is fine: `app_settings/key_bindings.xml` maps `C` + `SHIFT` to `toggle_down`. - The handler is fine: `agent_toggle_down` (`llviewerinput.cpp:123`) flips `LLAgent::mCrouch` and sends one `moveUp(-1)`. - What's missing is the per-frame sustain. The crouch only holds if `AGENT_CONTROL_UP_NEG` is sent every frame while `mCrouch` is set. The original Alchemy code (b3bc362f6e) did this in the main loop in `llappviewer.cpp`, right after input scanning: ```cpp gKeyboard->scanKeyboard(); gViewerInput.scanMouse(); if (gAgent.isCrouching()) gAgent.moveUp(-1); ``` When Rye restored the crouch toggle (a8b8f2ef4d), the binding, handler and `mCrouch` state came back but this block didn't. `LLAgent::isCrouching()` now has no callers anywhere. **Fix:** - Re-add the sustain after the scan in the main loop. - Check that `moveUp(-1)` called every frame doesn't fight the camera. It skips `resetView` while `mCrouch` is set, so it should be fine. - Check that flying, jumping (which clears `mCrouch`), sitting and RLV still behave. While sitting, `UP_NEG` may need gating so it doesn't stand the avatar up or steer a vehicle.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sky_line/Slipstream#438
No description provided.