TouchSensor
- Last UpdatedFeb 19, 2025
- 2 minute read
Use the TouchSensor node to interact with one or more mesh objects with the mouse/touch.
-
The TouchSensor node generates events for mouseDown and mouseUp.
-
You can know if the mouse is over the target meshes.
Platform support
This node is fully supported on XR-Windows platform.
It is partially supported on XR-Portable Windows, XR-Portable iOS, XR-Portable Android, and XR-P WASM platforms.
Only over event is managed.
|
XR-WIN |
XR-P-WIN |
XR-P-IOS |
XR-P-AND |
XR-P-WASM |
|---|---|---|---|---|
|
Full support |
Partial support |
Partial support |
Partial support |
Partial support |
|
|
|
|
|
|
Code example
This is a code example for the TouchSensor node.
<TouchSensor name="touch_a01" mesh="Text_A01_TimeManager_Button" active="false"/>
Position
The TouchSensor node must be inside a context node, such as Context or Global.
TouchSensor fields
These are the fields for TouchSensor node. Only the node-specific fields are indicated, not fields obtained by inheritance.
Field inheritance: NodeBase > TouchSensor
|
Fields |
Type |
Use |
Default value |
Description |
|---|---|---|---|---|
|
active |
sbool |
Optional |
true |
Activates or deactivates the sensor. |
|
mesh |
sstring |
Optional |
Not set |
A comma-separated list of mesh objects. Use the names of mesh scene objects, not the mesh nodes. Verify that this list is correct to ensure the sensor works properly. |
|
mouseOver |
sbool |
Read only |
Not set |
Checks whether one of the mesh objects is under the mouse/touch. |
|
mouseDown |
sevent |
Read only |
Not set |
Sent when clicked over a mesh object that is defined in mesh list. |
|
mouseUp |
sevent |
Read only |
Not set |
Sent when released over a mesh object that is defined in mesh list. |