void SetUpDetectors() { var detectorHolder = UnityHelper.CreateGameObjectAsChild("Warp Detector Holder", transform).gameObject; _OpenPalmDownwardsDetector = detectorHolder.AddComponent <DetectorLogicGate>(); _PalmDownwardsDetector = detectorHolder.AddComponent <PalmDirectionDetector>(); _PalmDownwardsDetector.HandModel = _Hand; _PalmDownwardsDetector.PointingDirection = new Vector3(0, -1, 0.5f).normalized; _PalmDownwardsDetector.OnAngle = 10; //_PalmDownwardsDetector.OffAngle = 60; _ExtendedFingerDetector = UnityHelper.CreateGameObjectAsChild("_ExtendedFingerDetector", detectorHolder.transform).gameObject.AddComponent <ExtendedFingerDetector>(); _ExtendedFingerDetector.HandModel = _Hand; _ExtendedFingerDetector.Thumb = PointingState.Extended; _ExtendedFingerDetector.Index = PointingState.Extended; _ExtendedFingerDetector.Middle = PointingState.Extended; _ExtendedFingerDetector.Ring = PointingState.Extended; _ExtendedFingerDetector.Pinky = PointingState.Extended; _Fistdetector = UnityHelper.CreateGameObjectAsChild("_Fistdetector", detectorHolder.transform).gameObject.AddComponent <ExtendedFingerDetector>(); _Fistdetector.HandModel = _Hand; _Fistdetector.Thumb = PointingState.Either; _Fistdetector.Index = PointingState.NotExtended; _Fistdetector.Middle = PointingState.NotExtended; _Fistdetector.Ring = PointingState.NotExtended; _Fistdetector.Pinky = PointingState.NotExtended; _OpenPalmDownwardsDetector.AddDetector(_PalmDownwardsDetector); _OpenPalmDownwardsDetector.AddDetector(_ExtendedFingerDetector); _OpenPalmDownwardsDetector.OnActivate.AddListener(OnOpenPalmDownwardStart); _OpenPalmDownwardsDetector.OnDeactivate.AddListener(OnOpenPalmDownwardEnd); _Fistdetector.OnActivate.AddListener(OnFist); }
void SetUpDetectors() { _Left = UnityHelper.CreateGameObjectAsChild("Pinch Detector", transform).gameObject.AddComponent <PinchDetector>(); _Right = UnityHelper.CreateGameObjectAsChild("Pinch Detector", transform).gameObject.AddComponent <PinchDetector>(); _Proximity = VR.Mode.LeftHand.PinchPoint.gameObject.AddComponent <ProximityDetector>(); _Proximity.TargetObjects = new GameObject[] { VR.Mode.RightHand.PinchPoint.gameObject }; _Proximity.OnDistance = 0.1f; _Proximity.OffDistance = 0.11f; _Detector = gameObject.AddComponent <DetectorLogicGate>(); _StartDetector = gameObject.AddComponent <DetectorLogicGate>(); _Left._handModel = VR.Mode.LeftHand; _Right._handModel = VR.Mode.RightHand; _StartDetector.AddDetector(_Left); _StartDetector.AddDetector(_Right); _StartDetector.AddDetector(_Proximity); _Detector.AddDetector(_Left); _Detector.AddDetector(_Right); _StartDetector.OnActivate.AddListener(OnStartPinch); _Detector.OnDeactivate.AddListener(OnStopPinch); }