Read Mouse State

Reads the current state of the mouse. You can choose which mouse element this node is associated with. When mouse element is chosen to be a button, only outputs:isPressed is meaningful. When coordinates are chosen, only outputs:coords and outputs:window are meaningful. Pixel coordinates are the position of the mouse cursor in screen pixel units with (0,0) top left. Normalized coordinates are values between 0-1 where 0 is top/left and 1 is bottom/right. By default, coordinates are relative to the application window, but if ‘Use Relative Coords’ is set to true, then coordinates are relative to the workspace window containing the mouse pointer.

Installation

To use this Node, you must enable omni.graph.ui_nodes in the Extension Manager.

Inputs

Name

Type

Description

Default

Mouse Element (mouseElement)

token

The mouse input to check the state of

Left Button

Use Relative Coords (useRelativeCoords)

bool

When true, the output ‘coords’ is made relative to the workspace window containing the mouse pointer instead of the entire application window

Outputs

Name

Type

Description

Default

isPressed

bool

True if the button is currently pressed, false otherwise. If the mouse element selected is a coordinate, this will output false.

coords

float[2]

The coordinates of the mouse. If the mouse element selected is a button, this will output a zero vector.

window

token

The name of the workspace window containing the mouse pointer if ‘Use Relative Coords’ is true and the mouse element selected is a coordinate