Selector2D
- Last UpdatedFeb 19, 2025
- 3 minute read
The Selector2D node is a singleton node. Only one instance of it can be present in an application.
This node is used to overlay a 2D selector to all interactable 2D components visualized on the screen; it allows to interact with 2D interfaces without using the mouse.
At runtime the selector scans for 2D visible elements and maps them, allowing it to move among them using its internal fields for position shifting.
It is useful for environments in which mouse usage is impossible (such as VR deployments on Oculus Rift or HTC Vive platforms) but it can be used to allow UI interaction with a joypad on standard screen deployments, too.
As with all the 2D nodes this node inherits from RectBase2D. For inherited fields, see RectBase2D.
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 |
|
|
|
|
|
|
Code example
This is a code example for the Selector2D node.
<Selector2D name="sel2d" image="mouse_pointer_sel.png" active="true" position="0 0" size="64 64" order="1"/>Inizio modulo
Selector2D fields
These are the fields for Selector2D. Only the node-specific fields are indicated, not fields obtained by inheritance.
Field inheritance: NodeBase > RectBase2D > Selector2D
|
Fields |
Type |
Use |
Default |
Description |
|---|---|---|---|---|
|
active |
sbool |
Optional |
true |
When set to true the mapping of interactable 2D nodes is working and the visible of the selector2D is set to true. If false then no mapping occurs and the visible is set to false and the position of the selector is set to -1000 -1000. |
|
image |
sstring |
Optional |
Image shown as selector cursor. If none is specified, the selector is not visible. |
|
|
moveDown |
sevent |
Event |
Whenever called this event will shift the selector to the center of the closest visible interactable 2D item below the current one. |
|
|
moveLeft |
sevent |
Event |
Whenever called this event will shift the selector to the center of the closest visible interactable 2D item at the left of the current one. |
|
|
moveUp |
sevent |
Event |
Whenever called this event will shift the selector to the center of the closest visible interactable 2D item above the current one. |
|
|
moveRight |
sevent |
Event |
Whenever called this event will shift the selector to the center of the closest visible interactable 2D item at the right of the current one. |
|
|
position |
svec2 |
Read only |
This field is inherited from RectBase2D, but in this case it is automatically set to match currently visible interactable 2D objects. |
|
|
selectDown |
sevent |
Event |
When called, it simulates the mouseDown event at the current position. |
|
|
selectUp |
sevent |
Event |
When called, it simulates the mouseUp event at the current position. |
