Skip to content

Commit a42aa19

Browse files
author
lawwong
committed
Update to v1.14.1
* Changes - Add Wave Hand Tracking support (Wave XR Plugin v4.1 or newer required) - Add fallback model for ViveFlowPhoneController and ViveFocus3Controller
2 parents c378eff + bf48eba commit a42aa19

File tree

14 files changed

+781
-31
lines changed

14 files changed

+781
-31
lines changed

Assets/HTC.UnityPlugin/VRModule/Modules/Editor/WaveVRModuleEditor.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,22 @@ public WaveVRSymbolRequirementCollection()
219219
},
220220
reqFileNames = new string[] { "wvr.cs" },
221221
});
222+
223+
Add(new SymbolRequirement()
224+
{
225+
symbol = "VIU_WAVEVR_HAND_TRACKING_CHECK",
226+
reqMethods = new SymbolRequirement.ReqMethodInfo[]
227+
{
228+
new SymbolRequirement.ReqMethodInfo()
229+
{
230+
typeName = "Wave.XR.BuildCheck.CheckIfHandTrackingEnabled",
231+
name = "ValidateEnabled",
232+
argTypeNames = new string[0],
233+
bindingAttr = BindingFlags.Public | BindingFlags.Static,
234+
}
235+
},
236+
reqFileNames = new string[] { "WaveXRBuildCheck.cs" },
237+
});
222238
}
223239
}
224240
}

Assets/HTC.UnityPlugin/VRModule/Modules/WaveVRModule.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public override bool shouldActive
5151
get
5252
{
5353
#if (VIU_WAVEXR_ESSENCE_CONTROLLER_MODEL || VIU_WAVEXR_ESSENCE_RENDERMODEL) && UNITY_ANDROID
54-
return true;
54+
return VIUSettings.enableWaveXRRenderModel;
5555
#else
5656
return false;
5757
#endif

Assets/HTC.UnityPlugin/VRModule/Submodules/PartialSettings/WaveHandTrackingSubmoduleSettings.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ public partial class VRModule : SingletonBehaviour<VRModule>
1717

1818
public partial class VRModuleSettings : ScriptableObject
1919
{
20-
public const bool ACTIVATE_WAVE_HAND_TRACKING_SUBMODULE_DEFAULT_VALUE = false;
21-
public const bool ENABLE_WAVE_HAND_GESTURE_DEFAULT_VALUE = false;
20+
public const bool ACTIVATE_WAVE_HAND_TRACKING_SUBMODULE_DEFAULT_VALUE = true;
21+
public const bool ENABLE_WAVE_HAND_GESTURE_DEFAULT_VALUE = true;
2222
public const bool ENABLE_WAVE_NATURAL_HAND_DEFAULT_VALUE = false;
2323
public const bool ENABLE_WAVE_ELECTRONIC_HAND_DEFAULT_VALUE = false;
2424
public const bool SHOW_WAVE_ELECTRONIC_HAND_WITH_CONTROLLER = false;

Assets/HTC.UnityPlugin/VRModule/Submodules/WaveHandTrackingSubmodule.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ private struct DeviceFeature
2222
{
2323
private ulong featuresField;
2424

25-
public bool supportedTracking
25+
public bool supportTracking
2626
{
2727
get { return (featuresField & (ulong)WVR_SupportedFeature.WVR_SupportedFeature_HandTracking) > 0ul; }
2828
}
2929

30-
public bool supportedGesture
30+
public bool supportGesture
3131
{
3232
get { return (featuresField & (ulong)WVR_SupportedFeature.WVR_SupportedFeature_HandGesture) > 0ul; }
3333
}
@@ -43,8 +43,7 @@ public void Fetch()
4343
private GestureActivator gestureActivator = GestureActivator.Default;
4444
private uint leftDeviceIndex = VRModule.INVALID_DEVICE_INDEX;
4545
private uint rightDeviceIndex = VRModule.INVALID_DEVICE_INDEX;
46-
private static WVR_HandTrackerType preferredTrackerType =
47-
VRModuleSettings.enableWaveNaturalHand ? WVR_HandTrackerType.WVR_HandTrackerType_Natural : WVR_HandTrackerType.WVR_HandTrackerType_Electronic;
46+
private static WVR_HandTrackerType preferredTrackerType = WVR_HandTrackerType.WVR_HandTrackerType_Natural;
4847
private static WVR_HandModelType showElectronicHandWithController =
4948
VRModuleSettings.showWaveElectronicHandWithController ?
5049
WVR_HandModelType.WVR_HandModelType_WithController : WVR_HandModelType.WVR_HandModelType_WithoutController;
@@ -58,12 +57,13 @@ protected override void OnActivated()
5857

5958
protected override void OnDeactivated()
6059
{
61-
//GestureInterface.StopGestureDetection();
60+
trackingActivator.SetActive(false);
61+
gestureActivator.SetActive(false);
6262
}
6363

6464
protected override void OnUpdateDeviceConnectionAndPoses()
6565
{
66-
trackingActivator.SetActive(VRModuleSettings.activateWaveHandTrackingSubmodule);
66+
trackingActivator.SetActive(deviceFeature.supportTracking);
6767

6868
if (VRModule.trackingSpaceType == VRModuleTrackingSpaceType.RoomScale)
6969
{
@@ -144,7 +144,7 @@ protected override void OnUpdateDeviceConnectionAndPoses()
144144

145145
protected override void OnUpdateDeviceInput()
146146
{
147-
gestureActivator.SetActive(VRModuleSettings.enableWaveHandGesture);
147+
gestureActivator.SetActive(VRModuleSettings.enableWaveHandGesture && deviceFeature.supportGesture);
148148

149149
gestureActivator.TryFetchData();
150150

@@ -788,11 +788,13 @@ public void UpdateGestureInput(IVRModuleDeviceStateRW state, bool isLeft)
788788
state.SetButtonPress(VRModuleRawButton.GestureIndexUp, gesture == WVR_HandGestureType.WVR_HandGestureType_IndexUp);
789789
state.SetButtonPress(VRModuleRawButton.GestureOk, gesture == WVR_HandGestureType.WVR_HandGestureType_OK);
790790
state.SetButtonPress(VRModuleRawButton.GestureThumbUp, gesture == WVR_HandGestureType.WVR_HandGestureType_ThumbUp);
791+
state.SetButtonPress(VRModuleRawButton.System, gesture == WVR_HandGestureType.WVR_HandGestureType_Inverse);
791792
state.SetButtonTouch(VRModuleRawButton.GestureFist, gesture == WVR_HandGestureType.WVR_HandGestureType_Fist);
792793
state.SetButtonTouch(VRModuleRawButton.GestureFive, gesture == WVR_HandGestureType.WVR_HandGestureType_Five);
793794
state.SetButtonTouch(VRModuleRawButton.GestureIndexUp, gesture == WVR_HandGestureType.WVR_HandGestureType_IndexUp);
794795
state.SetButtonTouch(VRModuleRawButton.GestureOk, gesture == WVR_HandGestureType.WVR_HandGestureType_OK);
795796
state.SetButtonTouch(VRModuleRawButton.GestureThumbUp, gesture == WVR_HandGestureType.WVR_HandGestureType_ThumbUp);
797+
state.SetButtonTouch(VRModuleRawButton.System, gesture == WVR_HandGestureType.WVR_HandGestureType_Inverse);
796798
}
797799

798800
public bool isLeftValid { get { return gestureData.left != WVR_HandGestureType.WVR_HandGestureType_Invalid; } }

Assets/HTC.UnityPlugin/VRModule/VRModuleBase.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ private struct WVRCtrlProfile
5858
private static WVRCtrlProfile[] s_wvrCtrlProfiles = new WVRCtrlProfile[]
5959
{
6060
// WVR_CONTROLLER_FINCH3DOF_2_0_PAC_20_9_DARK
61-
new WVRCtrlProfile { reg = new Regex("^.*(pac).*$", REGEX_OPTIONS), model = VRModuleDeviceModel.ViveFlowPhoneController, input2D = VRModuleInput2DType.TouchpadOnly },
61+
new WVRCtrlProfile { reg = new Regex("pac", REGEX_OPTIONS), model = VRModuleDeviceModel.ViveFlowPhoneController, input2D = VRModuleInput2DType.TouchpadOnly },
6262
// WVR_CONTROLLER_FINCH3DOF_2_0
63-
new WVRCtrlProfile { reg = new Regex("^.*(finch).*$", REGEX_OPTIONS), model = VRModuleDeviceModel.ViveFocusFinch, input2D = VRModuleInput2DType.TouchpadOnly },
63+
new WVRCtrlProfile { reg = new Regex("finch", REGEX_OPTIONS), model = VRModuleDeviceModel.ViveFocusFinch, input2D = VRModuleInput2DType.TouchpadOnly },
6464
// WVR_CONTROLLER_ASPEN_MI6_1, WVR_CONTROLLER_ASPEN_XA_XB
65-
new WVRCtrlProfile { reg = new Regex("^.*(aspen).*$", REGEX_OPTIONS), model = VRModuleDeviceModel.ViveFocusChirp, input2D = VRModuleInput2DType.TouchpadOnly },
65+
new WVRCtrlProfile { reg = new Regex("aspen", REGEX_OPTIONS), model = VRModuleDeviceModel.ViveFocusChirp, input2D = VRModuleInput2DType.TouchpadOnly },
6666
// WVR_CR_Left_001
67-
new WVRCtrlProfile { reg = new Regex("^.*(cr).(left)*$", REGEX_OPTIONS), model = VRModuleDeviceModel.ViveFocus3ControllerLeft, input2D = VRModuleInput2DType.TouchpadOnly },
67+
new WVRCtrlProfile { reg = new Regex("cr.+left", REGEX_OPTIONS), model = VRModuleDeviceModel.ViveFocus3ControllerLeft, input2D = VRModuleInput2DType.JoystickOnly },
6868
// WVR_CR_Right_001
69-
new WVRCtrlProfile { reg = new Regex("^.*(cr).(right)*$", REGEX_OPTIONS), model = VRModuleDeviceModel.ViveFocus3ControllerRight, input2D = VRModuleInput2DType.TouchpadOnly },
69+
new WVRCtrlProfile { reg = new Regex("cr.+right", REGEX_OPTIONS), model = VRModuleDeviceModel.ViveFocus3ControllerRight, input2D = VRModuleInput2DType.JoystickOnly },
7070
};
7171

7272
public bool isActivated { get; private set; }

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

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

0 commit comments

Comments
 (0)