INPUTS

Input handling (keyboard, mouse, controller).

Availability: Client-only

Methods


INPUTS.disableDefault

client

Disable sending default input to the server (client-side only)

Signature: action()

GAME.INPUTS.disableDefault();

INPUTS.enableDefault

client

Re-enable sending default input to the server (client-side only)

Signature: action()

GAME.INPUTS.enableDefault();

INPUTS.freeMouse

client

Release the mouse from pointer lock and enable free cursor

Signature: action()

GAME.INPUTS.freeMouse();

INPUTS.keyDown

client

Check if a specific key is currently pressed

Signature: bool action(num)

Parameters:

NameTypeDescription
keyCodenumThe key code to check

Returns: bool - True if the key is pressed

bool result = GAME.INPUTS.keyDown(0);

INPUTS.lockMouse

client

Lock the mouse and re-enable game controls

Signature: action()

GAME.INPUTS.lockMouse();

INPUTS.mouseMovement

client

Get the mouse movement delta since last frame

Signature: obj action()

Returns: obj - Object with x and y movement values

obj result = GAME.INPUTS.mouseMovement();

INPUTS.mousePos

client

Get the current mouse position on screen

Signature: obj action()

Returns: obj - Object with x and y screen coordinates

obj result = GAME.INPUTS.mousePos();

INPUTS.mousePosOverlay

client

Get the mouse position relative to the overlay canvas

Signature: obj action()

Returns: obj - Object with x and y overlay coordinates

obj result = GAME.INPUTS.mousePosOverlay();

INPUTS.unlockMouse

client

Temporarily unlock the mouse and disable game controls

Signature: action()

GAME.INPUTS.unlockMouse();