Mouse
- Last UpdatedFeb 19, 2025
- 3 minute read
The Mouse node is used to map the system mouse and intercept its events.
Platform support
This node is supported on XR-Windows platform only.
|
XR-WIN |
XR-P-WIN |
XR-P-IOS |
XR-P-AND |
XR-P-WASM |
|---|---|---|---|---|
|
Full support |
No support |
No support |
No support |
No support |
|
|
|
|
|
|
Mouse pointer
In some cases, the normal mouse pointer cannot be used, such as when rendering on a VR helmet.
In other cases, such as to change aspect or scale, you may need to directly manage a mouse pointer.
For these reasons, you can enable the display of a Rect2D element, which is referenced by the mouseImage parameter over the mouse screen position.
To enable Rect display
-
Set the Visible field to true.
Disable the windows mouse in the application config file.
Use the referenced Rect2D node to change the aspect of the mouse pointer.
Code example
This is a code example for Mouse node.
<!-- mouse declaration-->
<!-- observe that visible is referred to mouseImage Rect element and not to system icon-->
<Mouse name="aMouse" visible="false" active="true"/>
<!-- execute code based on mouse action -->
<route from="aMouse.leftDoubleClicked" to="cmd_logCoordinates.execute" value="[@aMouse.mousePosition]" />
<Command name="cmd_logCoordinates" args="pos=svec2">
<log text="Mouse double-clicked at [@%pos%]" />
</Command>
Mouse fields
These are the fields for Mouse node. Only the node-specific fields are indicated, not fields obtained by inheritance.
Field inheritance: NodeBase > MouseSensor
|
Fields |
Type |
Use |
Default value |
Description |
|---|---|---|---|---|
|
active |
sbool |
Optional |
true |
Set to false to avoid mouse events to be traced. |
|
leftClicked |
sevent |
Read only |
Internally calculated |
Raised when mouse left button is clicked. |
|
leftDoubleClicked |
sevent |
Read only |
Internally calculated |
Raised when mouse left button is double-clicked. |
|
leftDown |
sevent |
Read only |
Internally calculated |
Raised when mouse left button is pressed. |
|
leftUp |
sevent |
Read only |
Internally calculated |
Raised when mouse left button is released. |
|
middleDown |
sevent |
Read only |
Internally calculated |
Raised when mouse central button is pressed. |
|
middleUp |
sevent |
Read only |
Internally calculated |
Raised when mouse central button is released. |
|
mousePosition |
svec2 |
Read only |
Internally calculated |
Mouse current position in pixels. |
|
mousePositionUnit |
svec2 |
Read only |
Internally calculated |
Mouse current position in points. |
|
mouseImage |
sstring |
Optional |
Name of the Rect (Legacy) node to represent the mouse. Even if no default is set in code, it is set to mouse_pointer rect by PAK files. |
|
|
rightClicked |
sevent |
Read only |
Internally calculated |
Raised when mouse right button is clicked. |
|
rightDown |
sevent |
Read only |
Internally calculated |
Raised when mouse right button is pressed. |
|
rightDoubleClicked |
sevent |
Read only |
Internally calculated |
Raised when mouse right button is double-clicked. |
|
rightUp |
sevent |
Read only |
Internally calculated |
Raised when mouse right button is released. |
|
visible |
sstring |
Optional |
false |
Displays the mouseImage to represent the mouse pointer. |
|
wheelDelta |
sfloat |
Read only |
Internally calculated |
When the wheel is still, the output is 0. When moving towards updates to 1. When moving backwards to -1. |