InputEventInjector
- Last UpdatedFeb 19, 2025
- 3 minute read
The InputEventInjector node is used to inject keyboard and mouse events into the engine. This can be used to simulate a virtual keyboard or mouse in platforms that don’t have support for these input devices. This node can be made to work in exclusive mode or shared mode. In Exclusive mode, the engine will only process the events from the InputEventInjector node. In the Shared mode, the engine will process events from the input devices as well as the InputEventInjector node.
Platform Support
This node is available on all platforms.
|
XR-WIN |
XR-P-WIN |
XR-P-IOS |
XR-P-AND |
XR-P-WASM |
|---|---|---|---|---|
|
Full support |
Full support |
Full support |
Full support |
Full support |
|
|
|
|
|
|
Keycodes
Keycode for some special keys are as follows.
|
Keycode |
Key |
|---|---|
|
SPACE |
SpaceBar Key |
|
RETURN |
Enter Key |
|
BACK |
Backspace key |
|
TAB |
Tab key |
|
SHIFTKEY |
Shift key |
|
CONTROLKEY |
Control Key |
|
MENU |
Alt key |
|
ESCAPE |
Escape key |
|
DELETE |
Delete key |
|
END |
End key |
|
INSERT |
Insert key |
|
HOME |
Home Key |
Code example
This is a code example for the InputEventInjector node.
<InputEventInjector name="iEvent" mode="shared"/>
<!-- Sending key down event for the key ‘K’ -->
<set name="iEvent.keyDown" value="K"/>
<!-- Sending key up event for the key ‘K’ -->
<set name="iEvent.keyUp" value="K"/>
<!-- Sending a mouse move event at (1000, 540) -->
<set name="iEvent.mouseMove" value="1000 540"/>
Fields
These are the fields for the InputEventInjector node. Only the node-specific fields are indicated, not fields obtained by inheritance.
Field inheritance: NodeBase > InputEventEjector
|
Fields |
Type |
Use |
Default |
Description |
|---|---|---|---|---|
|
keyDown |
sfunction |
Optional |
Raises a keyboard DOWN event. This function takes the key as an input parameter to simulate key down event. |
|
|
keyUp |
sfunction |
Optional |
Raises a keyboard UP event. This function takes the key as an input parameter to simulate key up event. |
|
|
mode |
senum |
Mandatory |
Shared |
|
|
mouseLeftDown |
sfunction |
Optional |
Raises a mouse left button DOWN event. This function takes mouse pixel values in grid coordinates as input parameters. |
|
|
mouseLeftUp |
sfunction |
Optional |
Raises a mouse left button UP event. This function takes mouse pixel values in grid coordinates as input parameters. |
|
|
mouseMiddleDown |
sfunction |
Optional |
Raises a mouse middle button DOWN event. This function takes mouse pixel values in grid coordinates as input parameters. |
|
|
mouseMiddleUp |
sfunction |
Optional |
Raises a mouse middle button UP event. This function takes mouse pixel values in grid coordinates as input parameters. |
|
|
mouseMove |
sfunction |
Optional |
Raises a mouse MOVE event. This function takes mouse pixel values in grid coordinates as input parameters. |
|
|
mouseRightDown |
sfunction |
Optional |
Raises a mouse right button DOWN event. This function takes mouse pixel values in grid coordinates as input parameters. |
|
|
mouseRightUp |
sfunction |
Optional |
Raises a mouse right button UP event. This function takes mouse pixel values in grid coordinates as input parameters. |