Skip to content

Commit

Permalink
Update to v1.14.1
Browse files Browse the repository at this point in the history
* Changes
  - Add Wave Hand Tracking support (Wave XR Plugin v4.1 or newer required)
  - Add fallback model for ViveFlowPhoneController and ViveFocus3Controller
  • Loading branch information
lawwong committed Dec 14, 2021
2 parents c378eff + bf48eba commit a42aa19
Show file tree
Hide file tree
Showing 14 changed files with 781 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,22 @@ public WaveVRSymbolRequirementCollection()
},
reqFileNames = new string[] { "wvr.cs" },
});

Add(new SymbolRequirement()
{
symbol = "VIU_WAVEVR_HAND_TRACKING_CHECK",
reqMethods = new SymbolRequirement.ReqMethodInfo[]
{
new SymbolRequirement.ReqMethodInfo()
{
typeName = "Wave.XR.BuildCheck.CheckIfHandTrackingEnabled",
name = "ValidateEnabled",
argTypeNames = new string[0],
bindingAttr = BindingFlags.Public | BindingFlags.Static,
}
},
reqFileNames = new string[] { "WaveXRBuildCheck.cs" },
});
}
}
}
2 changes: 1 addition & 1 deletion Assets/HTC.UnityPlugin/VRModule/Modules/WaveVRModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public override bool shouldActive
get
{
#if (VIU_WAVEXR_ESSENCE_CONTROLLER_MODEL || VIU_WAVEXR_ESSENCE_RENDERMODEL) && UNITY_ANDROID
return true;
return VIUSettings.enableWaveXRRenderModel;
#else
return false;
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public partial class VRModule : SingletonBehaviour<VRModule>

public partial class VRModuleSettings : ScriptableObject
{
public const bool ACTIVATE_WAVE_HAND_TRACKING_SUBMODULE_DEFAULT_VALUE = false;
public const bool ENABLE_WAVE_HAND_GESTURE_DEFAULT_VALUE = false;
public const bool ACTIVATE_WAVE_HAND_TRACKING_SUBMODULE_DEFAULT_VALUE = true;
public const bool ENABLE_WAVE_HAND_GESTURE_DEFAULT_VALUE = true;
public const bool ENABLE_WAVE_NATURAL_HAND_DEFAULT_VALUE = false;
public const bool ENABLE_WAVE_ELECTRONIC_HAND_DEFAULT_VALUE = false;
public const bool SHOW_WAVE_ELECTRONIC_HAND_WITH_CONTROLLER = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ private struct DeviceFeature
{
private ulong featuresField;

public bool supportedTracking
public bool supportTracking
{
get { return (featuresField & (ulong)WVR_SupportedFeature.WVR_SupportedFeature_HandTracking) > 0ul; }
}

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

protected override void OnDeactivated()
{
//GestureInterface.StopGestureDetection();
trackingActivator.SetActive(false);
gestureActivator.SetActive(false);
}

protected override void OnUpdateDeviceConnectionAndPoses()
{
trackingActivator.SetActive(VRModuleSettings.activateWaveHandTrackingSubmodule);
trackingActivator.SetActive(deviceFeature.supportTracking);

if (VRModule.trackingSpaceType == VRModuleTrackingSpaceType.RoomScale)
{
Expand Down Expand Up @@ -144,7 +144,7 @@ protected override void OnUpdateDeviceConnectionAndPoses()

protected override void OnUpdateDeviceInput()
{
gestureActivator.SetActive(VRModuleSettings.enableWaveHandGesture);
gestureActivator.SetActive(VRModuleSettings.enableWaveHandGesture && deviceFeature.supportGesture);

gestureActivator.TryFetchData();

Expand Down Expand Up @@ -788,11 +788,13 @@ public void UpdateGestureInput(IVRModuleDeviceStateRW state, bool isLeft)
state.SetButtonPress(VRModuleRawButton.GestureIndexUp, gesture == WVR_HandGestureType.WVR_HandGestureType_IndexUp);
state.SetButtonPress(VRModuleRawButton.GestureOk, gesture == WVR_HandGestureType.WVR_HandGestureType_OK);
state.SetButtonPress(VRModuleRawButton.GestureThumbUp, gesture == WVR_HandGestureType.WVR_HandGestureType_ThumbUp);
state.SetButtonPress(VRModuleRawButton.System, gesture == WVR_HandGestureType.WVR_HandGestureType_Inverse);
state.SetButtonTouch(VRModuleRawButton.GestureFist, gesture == WVR_HandGestureType.WVR_HandGestureType_Fist);
state.SetButtonTouch(VRModuleRawButton.GestureFive, gesture == WVR_HandGestureType.WVR_HandGestureType_Five);
state.SetButtonTouch(VRModuleRawButton.GestureIndexUp, gesture == WVR_HandGestureType.WVR_HandGestureType_IndexUp);
state.SetButtonTouch(VRModuleRawButton.GestureOk, gesture == WVR_HandGestureType.WVR_HandGestureType_OK);
state.SetButtonTouch(VRModuleRawButton.GestureThumbUp, gesture == WVR_HandGestureType.WVR_HandGestureType_ThumbUp);
state.SetButtonTouch(VRModuleRawButton.System, gesture == WVR_HandGestureType.WVR_HandGestureType_Inverse);
}

public bool isLeftValid { get { return gestureData.left != WVR_HandGestureType.WVR_HandGestureType_Invalid; } }
Expand Down
10 changes: 5 additions & 5 deletions Assets/HTC.UnityPlugin/VRModule/VRModuleBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ private struct WVRCtrlProfile
private static WVRCtrlProfile[] s_wvrCtrlProfiles = new WVRCtrlProfile[]
{
// WVR_CONTROLLER_FINCH3DOF_2_0_PAC_20_9_DARK
new WVRCtrlProfile { reg = new Regex("^.*(pac).*$", REGEX_OPTIONS), model = VRModuleDeviceModel.ViveFlowPhoneController, input2D = VRModuleInput2DType.TouchpadOnly },
new WVRCtrlProfile { reg = new Regex("pac", REGEX_OPTIONS), model = VRModuleDeviceModel.ViveFlowPhoneController, input2D = VRModuleInput2DType.TouchpadOnly },
// WVR_CONTROLLER_FINCH3DOF_2_0
new WVRCtrlProfile { reg = new Regex("^.*(finch).*$", REGEX_OPTIONS), model = VRModuleDeviceModel.ViveFocusFinch, input2D = VRModuleInput2DType.TouchpadOnly },
new WVRCtrlProfile { reg = new Regex("finch", REGEX_OPTIONS), model = VRModuleDeviceModel.ViveFocusFinch, input2D = VRModuleInput2DType.TouchpadOnly },
// WVR_CONTROLLER_ASPEN_MI6_1, WVR_CONTROLLER_ASPEN_XA_XB
new WVRCtrlProfile { reg = new Regex("^.*(aspen).*$", REGEX_OPTIONS), model = VRModuleDeviceModel.ViveFocusChirp, input2D = VRModuleInput2DType.TouchpadOnly },
new WVRCtrlProfile { reg = new Regex("aspen", REGEX_OPTIONS), model = VRModuleDeviceModel.ViveFocusChirp, input2D = VRModuleInput2DType.TouchpadOnly },
// WVR_CR_Left_001
new WVRCtrlProfile { reg = new Regex("^.*(cr).(left)*$", REGEX_OPTIONS), model = VRModuleDeviceModel.ViveFocus3ControllerLeft, input2D = VRModuleInput2DType.TouchpadOnly },
new WVRCtrlProfile { reg = new Regex("cr.+left", REGEX_OPTIONS), model = VRModuleDeviceModel.ViveFocus3ControllerLeft, input2D = VRModuleInput2DType.JoystickOnly },
// WVR_CR_Right_001
new WVRCtrlProfile { reg = new Regex("^.*(cr).(right)*$", REGEX_OPTIONS), model = VRModuleDeviceModel.ViveFocus3ControllerRight, input2D = VRModuleInput2DType.TouchpadOnly },
new WVRCtrlProfile { reg = new Regex("cr.+right", REGEX_OPTIONS), model = VRModuleDeviceModel.ViveFocus3ControllerRight, input2D = VRModuleInput2DType.JoystickOnly },
};

public bool isActivated { get; private set; }
Expand Down
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a42aa19

Please sign in to comment.