onClientCursorMove
ClientEvent
Fired when the mouse moves.
addEventHandler("onClientCursorMove", root, function(float cursorX, float cursorY, float absoluteX, float absoluteY, float worldX, worldY, worldZ) … end)
Handler parameters
| Name | Type | Description |
|---|---|---|
| cursorX | float | Horizontal position relative to the screen, from 0 to 1. |
| cursorY | float | Vertical position relative to the screen, from 0 to 1. |
| absoluteX | float | Horizontal position in pixels. |
| absoluteY | float | Vertical position in pixels. |
| worldX, worldY, worldZ | float | A world point 300 units ahead of the camera, in that position's direction. |
Source
The root element (root).
While the cursor shows, it fires when the cursor moves to another pixel. While the cursor is hidden, it fires on every mouse movement, and the position is the screen's centre plus how far the mouse moved.
Example
addEventHandler("onClientCursorMove", root, function(cx, cy, x, y)
if isCursorShowing() then
outputDebugString(("cursor at %.0f, %.0f"):format(x, y))
end
end)