SpaceMouse
- Last UpdatedFeb 19, 2025
- 3 minute read
The SpaceMouse is an alternative to gamepad, mouse, and keyboard to navigate a 3D environment.
-
This node is a singleton node.
-
As a SpaceMouse node called spaceMouse is already defined in commons module. No other instance is allowed.
-
Device position and orientation are relative to SpaceMouse zero position.
-
Device X and Y are the plane axis. Z is the up axis.

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 SpaceMouse node.
<!-- spacemouse declaration -->
<SpaceMouse name="spaceMouse"/>
<!-- using space mouse to move a mesh -->
<Mesh name="cube" mesh="template_dr|cube_default" rotationMatrix="transform" rotation="0 0 0 1" />
<route from="spaceMouse.connected" to="crt_moveMesh.execute" />
<Coroutine name="crt_moveMesh">
<local name="posX" type="sfloat" value="0" />
<local name="posY" type="sfloat" value="0" />
<local name="posZ" type="sfloat" value="0" />
<local name="speed" type="sfloat" value="0.1" />
<wait condition="[@spaceMouse.connected]==true" >
<set name="posX" value="#[@cube.position.x]+[@spaceMouse.devicePosition.x]*[@%speed%]*[@crt_moveMesh.deltaTime]#" />
<set name="posY" value="#[@cube.position.y]+[@spaceMouse.devicePosition.y]*[@%speed%]*[@crt_moveMesh.deltaTime]#" />
<set name="posZ" value="#[@cube.position.z]+[@spaceMouse.devicePosition.z]*[@%speed%]*[@crt_moveMesh.deltaTime]#" />
<set name="cube.position" value="[@%posX%] [@%posY%] [@%posZ%]"/>
</wait>
</Coroutine>
SpaceMouse fields
These are the fields for SpaceMouse node. Only the node-specific fields are indicated, not fields obtained by inheritance.
Field inheritance: NodeBase > SpaceMouse
|
Fields |
Type |
Use |
Default value |
Description |
|---|---|---|---|---|
|
active |
sbool |
Optional |
true |
Set to false to avoid space mouse events to be traced. |
|
connected |
sbool |
Read only |
Internally calculated |
Set to true if a space mouse device is connected. |
|
deviceOrientation |
svec3 |
Read only |
Internally calculated |
Yaw, Pitch, and Roll measured by the device. |
|
devicePosition |
svec3 |
Read only |
Internally calculated |
Device position measured on the X, Y and Z axis. |
|
lightEnabled |
sbool |
Optional |
true |
Switches device light on and off. |
|
orientation |
svec3 |
Read only |
Internally calculated |
Device orientation after applying scaling factors. |
|
position |
svec3 |
Read only |
Internally calculated |
Device position after applying scaling factors. |
|
scaleOrientation |
svec3 |
Optional |
-0.002 -0.002 -0.002 |
Adapts device sensitivity on Yaw, Pitch, and Roll movements. |
|
scalePositionX |
svec3 |
Optional |
3000 0.002 0.01 |
Adapts the device sensitivity on the X axis. The first value is a threshold, second value is scale factor below the threshold, third value is scale factor above. |
|
scalePositionY |
svec3 |
Optional |
3000 0.002 0.01 |
Adapts device sensitivity on the Y axis. The first value is a threshold, second is scale factor below the threshold, third is scale factor above. |
|
scalePositionZ |
svec3 |
Optional |
8000 -0.002 -0.0 |
Adapts device sensitivity on the Z axis. The first value is a threshold, second is scale factor below the threshold, third is scale factor above. |