M MY Multiplayer: Wiki
Side
Kind

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

NameTypeDescription
cursorXfloatHorizontal position relative to the screen, from 0 to 1.
cursorYfloatVertical position relative to the screen, from 0 to 1.
absoluteXfloatHorizontal position in pixels.
absoluteYfloatVertical position in pixels.
worldX, worldY, worldZfloatA 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)

See also