PositionSensor
- Last UpdatedOct 22, 2025
- 2 minute read
The PositionSensor node defines a position sensor. This sensor is a cube or a cylinder that can be positioned, orientated, and stretched. As the avatar (whose position coordinate is between its feet) enters/exits, the sensor geometry events are raised.
Platform support
This node is fully supported on XR-Windows, XR-Portable Windows, XR-Portable iOS, XR-Portable Android, and XR-Portable WASM 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 |
|
|
|
|
|
|
Code example
This is a code example for the PositionSensor node.
<PositionSensor name="prova" position="8.960304 -2 6.130682" size="1 1 1" avatarNode="localAvatar" visible="true"/>
PositionSensor fields
These are the fields for PositionSensor node. Only the node-specific fields are indicated, not fields obtained by inheritance.
Field inheritance: NodeBase > PositionSensor
|
Fields |
Type |
Use |
Default value |
Description |
|---|---|---|---|---|
|
_debug |
sbool |
Optional |
false |
Set to true to see the geometry of the sensor. Should be used only for development purposes. |
|
avatarNode |
sstring |
Optional |
localAvatar |
Name of the avatar node that can interact with the sensor. |
|
inside |
sbool |
Read only |
No default |
Becomes true if the avatar is inside the sensor. |
|
mode |
senum |
Optional |
avatar |
When set to Camera, the sensor reacts to currently shown camera position instead of to Avatar position. |
|
mwxTemplate |
sstring |
Optional |
simulazione\position_sensor.mwx |
Can be overridden to use a different source MWX than standard one. |
|
onEnter |
sevent |
Read only |
No default |
Raised when avatar enters the sensor. |
|
onExit |
sevent |
Read only |
No default |
Raised when avatar exits the sensor. |
|
position |
svec3 |
Optional |
0 0 0 |
Defines sensor position inside the scenario. |
|
size |
svec3 |
Optional |
1 1 1 |
Sensor size in meters. For the cylinder, x is the diameter and y is the height, while z is not used. |
|
type |
senum |
Optional |
Cube |
Specify type as cube or cylinder sensor. |
|
yaw |
sfloat |
Optional |
0 |
Yaw of the sensor. Used only for cube type sensors. |