- Documentation
- Client events
- onClientCursorMove
Event
onClientCursorMove
The cursor moved (only while it is visible; at most once per frame).
Handler
addEventHandler("onClientCursorMove", root, function(cursorX, cursorY, absoluteX, absoluteY, worldX, worldY, worldZ) ... end)Parameters
cursorX, cursorYfloat- Relative position 0-1.
absoluteX, absoluteYfloat- Position in screen pixels.
worldX, worldY, worldZfloat- World point 300 m into the screen under the cursor.
Source
source is root.
Example
addEventHandler("onClientCursorMove", root, function(_, _, x, y)
hovered = x > 100 and x < 300 and y > 100 and y < 140
end)
See also
getCursorPositionReturns the cursor position as a fraction of the screen 0-1 (x, y). Works only while the cursor is shown. The next three results (a world point) are zeros for now;getWorldFromScreenPositiongives the world point under the cursor.onClientClickThe player clicked the mouse with the cursor visible (outside GUI windows).