Skip to content

Add #5215: Add onClientMouseMove event for raw mouse delta - #5237

Open
x6c85 wants to merge 2 commits into
multitheftauto:masterfrom
x6c85:feature/5215-onClientMouseMove
Open

Add #5215: Add onClientMouseMove event for raw mouse delta#5237
x6c85 wants to merge 2 commits into
multitheftauto:masterfrom
x6c85:feature/5215-onClientMouseMove

Conversation

@x6c85

@x6c85 x6c85 commented Aug 19, 2026

Copy link
Copy Markdown

Summary

Adds a new onClientMouseMove event that fires raw mouse deltas (deltaX, deltaY) using Windows Raw Input (WM_INPUT). Unlike onClientCursorMove which only reports clamped screen coordinates, this event works regardless of cursor visibility or camera target.

Motivation

Fixes #5215. onClientCursorMove arguments don't update when the cursor is hidden and the camera isn't targeting an entity, because it relies on WM_MOUSEMOVE which gives absolute clamped coordinates. This new event uses Raw Input to capture actual mouse deltas, enabling mouse flick detection for anti-cheats and first-person camera implementations.

Test plan

  1. addEventHandler("onClientMouseMove", root, function(dx, dy) outputChatBox(dx.." "..dy) end) - move mouse with cursor hidden, verify deltas are reported.
  2. Show cursor with showCursor(true) - both onClientCursorMove and onClientMouseMove fire.
  3. Fix camera at a position with no target entity - onClientMouseMove still reports deltas while onClientCursorMove coordinates stay clamped.
  4. Verify no performance regression from Raw Input registration.

Checklist

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

Uses Windows Raw Input (WM_INPUT) to capture mouse movement deltas
regardless of cursor visibility or camera target. Unlike onClientCursorMove
which reports clamped screen coordinates, this event fires deltaX/deltaY
values that work even when the cursor is hidden.
@x6c85
x6c85 force-pushed the feature/5215-onClientMouseMove branch from 3c0c271 to b38bddc Compare August 19, 2026 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add new client side event onClientMouseMove

1 participant