Skip to content

Commit b9ee634

Browse files
author
ChengNan
committed
Add ViveUltimateTracker support
1 parent 09a353a commit b9ee634

File tree

7 files changed

+231
-2
lines changed

7 files changed

+231
-2
lines changed

Assets/HTC.UnityPlugin/VRModule/VRModuleBase.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ protected enum DefaultModuleOrder
3636

3737
private static readonly Regex s_viveRgx = new Regex("^.*(vive|htc).*$", REGEX_OPTIONS);
3838
private static readonly Regex s_viveCosmosRgx = new Regex("^.*(cosmos).*$", REGEX_OPTIONS);
39+
private static readonly Regex s_viveUltRgx = new Regex("^.*ultimate.*$", REGEX_OPTIONS);
3940
private static readonly Regex s_focus3Rgx = new Regex("focus[\\s_\\-]*3", REGEX_OPTIONS);
4041
private static readonly Regex s_ver3Rgx = new Regex("^.*3.0.*$", REGEX_OPTIONS);
4142
private static readonly Regex s_oculusRgx = new Regex("^.*(oculus|quest).*$", REGEX_OPTIONS);
@@ -71,7 +72,7 @@ private struct WVRCtrlProfile
7172
// WVR_CR_Right_001
7273
new WVRCtrlProfile { reg = new Regex("cr.+right", REGEX_OPTIONS), model = VRModuleDeviceModel.ViveFocus3ControllerRight, input2D = VRModuleInput2DType.JoystickOnly },
7374
// Wave Tracker0 HTC-211012-Tracker0, Wave Tracker1 HTC-211012-Tracker1
74-
new WVRCtrlProfile { reg = new Regex("^.*(tracker).*$", REGEX_OPTIONS), model = VRModuleDeviceModel.ViveWristTracker, input2D = VRModuleInput2DType.None },
75+
new WVRCtrlProfile { reg = new Regex("^.*(tracker[0|1]).*$", REGEX_OPTIONS), model = VRModuleDeviceModel.ViveWristTracker, input2D = VRModuleInput2DType.None },
7576
};
7677

7778
public bool isActivated { get; private set; }
@@ -214,7 +215,11 @@ protected static void SetupKnownDeviceModel(IVRModuleDeviceStateRW deviceState)
214215
}
215216
return;
216217
case VRModuleDeviceClass.GenericTracker:
217-
if (s_ver3Rgx.IsMatch(deviceState.modelNumber))
218+
if (s_viveUltRgx.IsMatch(deviceState.renderModelName))
219+
{
220+
deviceState.deviceModel = VRModuleDeviceModel.ViveUltimateTracker;
221+
}
222+
else if (s_ver3Rgx.IsMatch(deviceState.modelNumber))
218223
{
219224
deviceState.deviceModel = VRModuleDeviceModel.ViveTracker3;
220225
}

Assets/HTC.UnityPlugin/VRModule/VRModuleDeviceState.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public enum VRModuleDeviceModel
7575
ViveWristTracker,
7676
OculusTouchProLeft,
7777
OculusTouchProRight,
78+
ViveUltimateTracker,
7879
}
7980

8081
public enum VRModuleRawButton
Binary file not shown.

Assets/HTC.UnityPlugin/ViveInputUtility/Resources/Models/ObjModelViveUltimateTracker.fbx.meta

Lines changed: 106 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!1 &6734541192188514468
4+
GameObject:
5+
m_ObjectHideFlags: 0
6+
m_CorrespondingSourceObject: {fileID: 0}
7+
m_PrefabInstance: {fileID: 0}
8+
m_PrefabAsset: {fileID: 0}
9+
serializedVersion: 6
10+
m_Component:
11+
- component: {fileID: 2268688005838436399}
12+
m_Layer: 0
13+
m_Name: VIUModelViveUltimateTracker
14+
m_TagString: Untagged
15+
m_Icon: {fileID: 0}
16+
m_NavMeshLayer: 0
17+
m_StaticEditorFlags: 0
18+
m_IsActive: 1
19+
--- !u!4 &2268688005838436399
20+
Transform:
21+
m_ObjectHideFlags: 0
22+
m_CorrespondingSourceObject: {fileID: 0}
23+
m_PrefabInstance: {fileID: 0}
24+
m_PrefabAsset: {fileID: 0}
25+
m_GameObject: {fileID: 6734541192188514468}
26+
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
27+
m_LocalPosition: {x: 0, y: 0, z: 0}
28+
m_LocalScale: {x: 1, y: 1, z: 1}
29+
m_ConstrainProportionsScale: 0
30+
m_Children:
31+
- {fileID: 7999427570738900244}
32+
m_Father: {fileID: 0}
33+
m_RootOrder: 0
34+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
35+
--- !u!1001 &3060504019060524558
36+
PrefabInstance:
37+
m_ObjectHideFlags: 0
38+
serializedVersion: 2
39+
m_Modification:
40+
m_TransformParent: {fileID: 2268688005838436399}
41+
m_Modifications:
42+
- target: {fileID: -4216859302048453862, guid: 610c6a4504338614eb8afbb41a153004,
43+
type: 3}
44+
propertyPath: m_RootOrder
45+
value: 0
46+
objectReference: {fileID: 0}
47+
- target: {fileID: -4216859302048453862, guid: 610c6a4504338614eb8afbb41a153004,
48+
type: 3}
49+
propertyPath: m_LocalPosition.x
50+
value: -0
51+
objectReference: {fileID: 0}
52+
- target: {fileID: -4216859302048453862, guid: 610c6a4504338614eb8afbb41a153004,
53+
type: 3}
54+
propertyPath: m_LocalPosition.y
55+
value: 0
56+
objectReference: {fileID: 0}
57+
- target: {fileID: -4216859302048453862, guid: 610c6a4504338614eb8afbb41a153004,
58+
type: 3}
59+
propertyPath: m_LocalPosition.z
60+
value: 0
61+
objectReference: {fileID: 0}
62+
- target: {fileID: -4216859302048453862, guid: 610c6a4504338614eb8afbb41a153004,
63+
type: 3}
64+
propertyPath: m_LocalRotation.w
65+
value: 1
66+
objectReference: {fileID: 0}
67+
- target: {fileID: -4216859302048453862, guid: 610c6a4504338614eb8afbb41a153004,
68+
type: 3}
69+
propertyPath: m_LocalRotation.x
70+
value: 0
71+
objectReference: {fileID: 0}
72+
- target: {fileID: -4216859302048453862, guid: 610c6a4504338614eb8afbb41a153004,
73+
type: 3}
74+
propertyPath: m_LocalRotation.y
75+
value: -0
76+
objectReference: {fileID: 0}
77+
- target: {fileID: -4216859302048453862, guid: 610c6a4504338614eb8afbb41a153004,
78+
type: 3}
79+
propertyPath: m_LocalRotation.z
80+
value: -0
81+
objectReference: {fileID: 0}
82+
- target: {fileID: -4216859302048453862, guid: 610c6a4504338614eb8afbb41a153004,
83+
type: 3}
84+
propertyPath: m_LocalEulerAnglesHint.x
85+
value: 0
86+
objectReference: {fileID: 0}
87+
- target: {fileID: -4216859302048453862, guid: 610c6a4504338614eb8afbb41a153004,
88+
type: 3}
89+
propertyPath: m_LocalEulerAnglesHint.y
90+
value: 0
91+
objectReference: {fileID: 0}
92+
- target: {fileID: -4216859302048453862, guid: 610c6a4504338614eb8afbb41a153004,
93+
type: 3}
94+
propertyPath: m_LocalEulerAnglesHint.z
95+
value: 0
96+
objectReference: {fileID: 0}
97+
- target: {fileID: -927199367670048503, guid: 610c6a4504338614eb8afbb41a153004,
98+
type: 3}
99+
propertyPath: m_Name
100+
value: ObjModelViveUltimateTracker
101+
objectReference: {fileID: 0}
102+
m_RemovedComponents: []
103+
m_SourcePrefab: {fileID: 100100000, guid: 610c6a4504338614eb8afbb41a153004, type: 3}
104+
--- !u!4 &7999427570738900244 stripped
105+
Transform:
106+
m_CorrespondingSourceObject: {fileID: -4216859302048453862, guid: 610c6a4504338614eb8afbb41a153004,
107+
type: 3}
108+
m_PrefabInstance: {fileID: 3060504019060524558}
109+
m_PrefabAsset: {fileID: 0}

Assets/HTC.UnityPlugin/ViveInputUtility/Resources/Models/VIUModelViveUltimateTracker.prefab.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/HTC.UnityPlugin/ViveInputUtility/Scripts/Misc/RenderModelHook.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ public enum OverrideModelEnum
250250
OculusQuest2ControllerLeft = VRModuleDeviceModel.OculusQuest2ControllerLeft,
251251
OculusQuest2ControllerRight = VRModuleDeviceModel.OculusQuest2ControllerRight,
252252
ViveWristTracker = VRModuleDeviceModel.ViveWristTracker,
253+
ViveUltimateTracker = VRModuleDeviceModel.ViveUltimateTracker,
253254
}
254255

255256
[SerializeField]

0 commit comments

Comments
 (0)