Skip to content

Commit e2dbb67

Browse files
peterpeter
authored andcommitted
fix unity config and clarify its for for space mouse wirless new
Source: https://docs.unity3d.com/6000.3/Documentation/Manual/QuaternionAndEulerRotationsInUnity.html > Unity uses a left-handed coordinate system: the positive x-axis points to the right, the positive y-axis points up, and the positive z-axis points forward. Unity’s left-handed coordinate system means that the direction of rotation from the positive x-axis to the positive y-axis is counterclockwise when looking along the positive z-axis.
1 parent 7bd2219 commit e2dbb67

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

examples/10_custom_config_unity.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"""Example: Custom device configuration
33
44
This example shows how to create entirely custom device configurations,
5-
In this case following the left-handed Unity convention (Z forward, X right, Y up).
5+
In this case for a "Spacemouse Wireless New", following the left-handed Unity convention (Z forward, X right, Y up).
6+
If you have a totally custom HID device, you just need to know the byte layout of the device and you can create a custom configuration for it.
67
"""
78

89
import time
@@ -25,12 +26,12 @@ def example_unity_convention():
2526
mappings={
2627
# Each mapping: (channel, byte1, byte2, scale)
2728
# Scale: 1 = normal direction, -1 = inverted
28-
"y": (1, 1, 2, 1),
29+
"x": (1, 1, 2, 1),
30+
"y": (1, 5, 6, -1),
2931
"z": (1, 3, 4, -1),
30-
"x": (1, 5, 6, 1),
31-
"yaw": (1, 7, 8, -1),
32-
"roll": (1, 9, 10, -1),
32+
"yaw": (1, 9, 10, 1),
3333
"pitch": (1, 11, 12, 1),
34+
"roll": (1, 7, 8, -1),
3435
},
3536
buttons={
3637
"LEFT": (3, 1, 0),
@@ -44,7 +45,7 @@ def example_unity_convention():
4445
print(f" Buttons: {custom_spec.button_names}")
4546

4647
with pyspacemouse.open(device_spec=custom_spec) as device:
47-
print(f"Connected to: {device.name} with Unity convention")
48+
print(f"Connected to: {device.name} with custom spec")
4849

4950
for _ in range(5000):
5051
state = device.read()

0 commit comments

Comments
 (0)