Skip to content

Commit 8a5e171

Browse files
committed
Support Vive Trackers
Add default bindings Add new T actions Add new source input handles
1 parent b93158e commit 8a5e171

14 files changed

+312
-7
lines changed

OpenVR2Key/MainController.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class MainController
3434
// Other
3535
private string _currentApplicationId = "";
3636
private ulong _inputSourceHandleLeft = 0, _inputSourceHandleRight = 0;
37+
private ulong[] _inputSourceHandles = new ulong[10];
3738
private ulong _notificationOverlayHandle = 0;
3839
private string[] _actionKeys = new string[0];
3940

@@ -184,10 +185,7 @@ private void WorkerThread()
184185
}
185186
else
186187
{
187-
_ovr.UpdateActionStates(new ulong[] {
188-
_inputSourceHandleLeft,
189-
_inputSourceHandleRight
190-
});
188+
_ovr.UpdateActionStates(_inputSourceHandles);
191189

192190
_ovr.UpdateEvents();
193191

@@ -214,6 +212,16 @@ private void UpdateInputSourceHandles()
214212
{
215213
_inputSourceHandleLeft = _ovr.GetInputSourceHandle(EasyOpenVRSingleton.InputSource.LeftHand);
216214
_inputSourceHandleRight = _ovr.GetInputSourceHandle(EasyOpenVRSingleton.InputSource.RightHand);
215+
_inputSourceHandles[0] = _inputSourceHandleLeft;
216+
_inputSourceHandles[1] = _inputSourceHandleRight;
217+
_inputSourceHandles[2] = _ovr.GetInputSourceHandle(EasyOpenVRSingleton.InputSource.Chest);
218+
_inputSourceHandles[3] = _ovr.GetInputSourceHandle(EasyOpenVRSingleton.InputSource.LeftElbow);
219+
_inputSourceHandles[4] = _ovr.GetInputSourceHandle(EasyOpenVRSingleton.InputSource.LeftKnee);
220+
_inputSourceHandles[5] = _ovr.GetInputSourceHandle(EasyOpenVRSingleton.InputSource.LeftFoot);
221+
_inputSourceHandles[6] = _ovr.GetInputSourceHandle(EasyOpenVRSingleton.InputSource.RightElbow);
222+
_inputSourceHandles[7] = _ovr.GetInputSourceHandle(EasyOpenVRSingleton.InputSource.RightKnee);
223+
_inputSourceHandles[8] = _ovr.GetInputSourceHandle(EasyOpenVRSingleton.InputSource.RightFoot);
224+
_inputSourceHandles[9] = _ovr.GetInputSourceHandle(EasyOpenVRSingleton.InputSource.Waist);
217225
}
218226

219227
// New app is running, distribute new app ID

OpenVR2Key/MainWindow.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ private string[] InitList(Dictionary<string, Key[]> config = null)
179179
actionKeys.AddRange(GenerateActionKeyRange(16, 'L')); // Left
180180
actionKeys.AddRange(GenerateActionKeyRange(16, 'R')); // Right
181181
actionKeys.AddRange(GenerateActionKeyRange(8, 'C')); // Chord
182+
actionKeys.AddRange(GenerateActionKeyRange(8, 'T')); // Tracker
182183
string[] GenerateActionKeyRange(int count, char type)
183184
{
184185
var keys = new List<string>();

OpenVR2Key/OpenVR2Key.csproj

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,30 @@
149149
<None Include="bindings_vive_controller.json">
150150
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
151151
</None>
152+
<None Include="bindings_vive_tracker_chest.json">
153+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
154+
</None>
155+
<None Include="bindings_vive_tracker_left_elbow.json">
156+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
157+
</None>
158+
<None Include="bindings_vive_tracker_left_foot.json">
159+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
160+
</None>
161+
<None Include="bindings_vive_tracker_left_knee.json">
162+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
163+
</None>
164+
<None Include="bindings_vive_tracker_right_elbow.json">
165+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
166+
</None>
167+
<None Include="bindings_vive_tracker_right_foot.json">
168+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
169+
</None>
170+
<None Include="bindings_vive_tracker_right_knee.json">
171+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
172+
</None>
173+
<None Include="bindings_vive_tracker_waist.json">
174+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
175+
</None>
152176
<None Include="EasyOpenVR\README.md" />
153177
<None Include="FodyWeavers.xsd">
154178
<SubType>Designer</SubType>

OpenVR2Key/Properties/Resources.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

OpenVR2Key/Properties/Resources.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,6 @@
128128
<value>..\resources\logo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
129129
</data>
130130
<data name="Version" xml:space="preserve">
131-
<value>v0.54</value>
131+
<value>v0.55</value>
132132
</data>
133133
</root>

OpenVR2Key/actions.json

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,38 @@
1111
{
1212
"controller_type": "oculus_touch",
1313
"binding_url": "bindings_oculus_touch.json"
14+
},
15+
{
16+
"controller_type": "vive_tracker_chest",
17+
"binding_url": "bindings_vive_tracker_chest.json"
18+
},
19+
{
20+
"controller_type": "vive_tracker_left_elbow",
21+
"binding_url": "bindings_vive_tracker_left_elbow.json"
22+
},
23+
{
24+
"controller_type": "vive_tracker_right_elbow",
25+
"binding_url": "bindings_vive_tracker_right_elbow.json"
26+
},
27+
{
28+
"controller_type": "vive_tracker_waist",
29+
"binding_url": "bindings_vive_tracker_waist.json"
30+
},
31+
{
32+
"controller_type": "vive_tracker_left_knee",
33+
"binding_url": "bindings_vive_tracker_left_knee.json"
34+
},
35+
{
36+
"controller_type": "vive_tracker_right_knee",
37+
"binding_url": "bindings_vive_tracker_right_knee.json"
38+
},
39+
{
40+
"controller_type": "vive_tracker_left_foot",
41+
"binding_url": "bindings_vive_tracker_left_foot.json"
42+
},
43+
{
44+
"controller_type": "vive_tracker_right_foot",
45+
"binding_url": "bindings_vive_tracker_right_foot.json"
1446
}
1547
],
1648
"actions": [
@@ -213,6 +245,46 @@
213245
"name": "/actions/keys/in/KeyC8",
214246
"requirement": "optional",
215247
"type": "boolean"
248+
},
249+
{
250+
"name": "/actions/keys/in/KeyT1",
251+
"requirement": "optional",
252+
"type": "boolean"
253+
},
254+
{
255+
"name": "/actions/keys/in/KeyT2",
256+
"requirement": "optional",
257+
"type": "boolean"
258+
},
259+
{
260+
"name": "/actions/keys/in/KeyT3",
261+
"requirement": "optional",
262+
"type": "boolean"
263+
},
264+
{
265+
"name": "/actions/keys/in/KeyT4",
266+
"requirement": "optional",
267+
"type": "boolean"
268+
},
269+
{
270+
"name": "/actions/keys/in/KeyT5",
271+
"requirement": "optional",
272+
"type": "boolean"
273+
},
274+
{
275+
"name": "/actions/keys/in/KeyT6",
276+
"requirement": "optional",
277+
"type": "boolean"
278+
},
279+
{
280+
"name": "/actions/keys/in/KeyT7",
281+
"requirement": "optional",
282+
"type": "boolean"
283+
},
284+
{
285+
"name": "/actions/keys/in/KeyT8",
286+
"requirement": "optional",
287+
"type": "boolean"
216288
}
217289
],
218290
"action_sets": [
@@ -264,7 +336,15 @@
264336
"/actions/keys/in/KeyC5": "Key Chord 5",
265337
"/actions/keys/in/KeyC6": "Key Chord 6",
266338
"/actions/keys/in/KeyC7": "Key Chord 7",
267-
"/actions/keys/in/KeyC8": "Key Chord 8"
339+
"/actions/keys/in/KeyC8": "Key Chord 8",
340+
"/actions/keys/in/KeyT1": "Key Tracker 1",
341+
"/actions/keys/in/KeyT2": "Key Tracker 2",
342+
"/actions/keys/in/KeyT3": "Key Tracker 3",
343+
"/actions/keys/in/KeyT4": "Key Tracker 4",
344+
"/actions/keys/in/KeyT5": "Key Tracker 5",
345+
"/actions/keys/in/KeyT6": "Key Tracker 6",
346+
"/actions/keys/in/KeyT7": "Key Tracker 7",
347+
"/actions/keys/in/KeyT8": "Key Tracker 8"
268348
}
269349
]
270350
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"bindings" : {
3+
"/actions/keys" : {
4+
"chords" : [],
5+
"haptics" : [],
6+
"poses" : [],
7+
"skeleton" : [],
8+
"sources" : [
9+
{
10+
"path": "/user/chest/input/power",
11+
"mode": "button",
12+
"inputs": {
13+
"click": {
14+
"output": "/actions/keys/in/keyt1"
15+
}
16+
}
17+
}
18+
]
19+
}
20+
},
21+
"controller_type" : "vive_tracker_chest",
22+
"description" : "Default OpenVR2Key input configuration for Vive Tracker Chest",
23+
"name" : "Chest Tracker"
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"bindings" : {
3+
"/actions/keys" : {
4+
"chords" : [],
5+
"haptics" : [],
6+
"poses" : [],
7+
"skeleton" : [],
8+
"sources" : [
9+
{
10+
"path": "/user/elbow/left/input/power",
11+
"mode": "button",
12+
"inputs": {
13+
"click": {
14+
"output": "/actions/keys/in/keyt2"
15+
}
16+
}
17+
}
18+
]
19+
}
20+
},
21+
"controller_type" : "vive_tracker_left_elbow",
22+
"description" : "Default OpenVR2Key input configuration for Vive Tracker Left Elbow",
23+
"name" : "Left Elbow Tracker"
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"bindings" : {
3+
"/actions/keys" : {
4+
"chords" : [],
5+
"haptics" : [],
6+
"poses" : [],
7+
"skeleton" : [],
8+
"sources" : [
9+
{
10+
"path": "/user/foot/left/input/power",
11+
"mode": "button",
12+
"inputs": {
13+
"click": {
14+
"output": "/actions/keys/in/keyt3"
15+
}
16+
}
17+
}
18+
]
19+
}
20+
},
21+
"controller_type" : "vive_tracker_left_foot",
22+
"description" : "Default OpenVR2Key input configuration for Vive Tracker Left Foot",
23+
"name" : "Left Foot Tracker"
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"bindings" : {
3+
"/actions/keys" : {
4+
"chords" : [],
5+
"haptics" : [],
6+
"poses" : [],
7+
"skeleton" : [],
8+
"sources" : [
9+
{
10+
"path": "/user/knee/left/input/power",
11+
"mode": "button",
12+
"inputs": {
13+
"click": {
14+
"output": "/actions/keys/in/keyt4"
15+
}
16+
}
17+
}
18+
]
19+
}
20+
},
21+
"controller_type" : "vive_tracker_left_knee",
22+
"description" : "Default OpenVR2Key input configuration for Vive Tracker Left Knee",
23+
"name" : "Left Knee Tracker"
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"bindings" : {
3+
"/actions/keys" : {
4+
"chords" : [],
5+
"haptics" : [],
6+
"poses" : [],
7+
"skeleton" : [],
8+
"sources" : [
9+
{
10+
"path": "/user/elbow/right/input/power",
11+
"mode": "button",
12+
"inputs": {
13+
"click": {
14+
"output": "/actions/keys/in/keyt5"
15+
}
16+
}
17+
}
18+
]
19+
}
20+
},
21+
"controller_type" : "vive_tracker_right_elbow",
22+
"description" : "Default OpenVR2Key input configuration for Vive Tracker Right Elbow",
23+
"name" : "Right Elbow Tracker"
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"bindings" : {
3+
"/actions/keys" : {
4+
"chords" : [],
5+
"haptics" : [],
6+
"poses" : [],
7+
"skeleton" : [],
8+
"sources" : [
9+
{
10+
"path": "/user/foot/right/input/power",
11+
"mode": "button",
12+
"inputs": {
13+
"click": {
14+
"output": "/actions/keys/in/keyt6"
15+
}
16+
}
17+
}
18+
]
19+
}
20+
},
21+
"controller_type" : "vive_tracker_right_foot",
22+
"description" : "Default OpenVR2Key input configuration for Vive Tracker Right Foot",
23+
"name" : "Right Foot Tracker"
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"bindings" : {
3+
"/actions/keys" : {
4+
"chords" : [],
5+
"haptics" : [],
6+
"poses" : [],
7+
"skeleton" : [],
8+
"sources" : [
9+
{
10+
"path": "/user/knee/right/input/power",
11+
"mode": "button",
12+
"inputs": {
13+
"click": {
14+
"output": "/actions/keys/in/keyt7"
15+
}
16+
}
17+
}
18+
]
19+
}
20+
},
21+
"controller_type" : "vive_tracker_right_knee",
22+
"description" : "Default OpenVR2Key input configuration for Vive Tracker Right Knee",
23+
"name" : "Right Knee Tracker"
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"bindings" : {
3+
"/actions/keys" : {
4+
"chords" : [],
5+
"haptics" : [],
6+
"poses" : [],
7+
"skeleton" : [],
8+
"sources" : [
9+
{
10+
"path": "/user/waist/input/power",
11+
"mode": "button",
12+
"inputs": {
13+
"click": {
14+
"output": "/actions/keys/in/keyt8"
15+
}
16+
}
17+
}
18+
]
19+
}
20+
},
21+
"controller_type" : "vive_tracker_waist",
22+
"description" : "Default OpenVR2Key input configuration for Vive Tracker Waist",
23+
"name" : "Waist Tracker"
24+
}

0 commit comments

Comments
 (0)