static void Postfix(ref float ___currentZoomVelocity, float ___zoomInTime, float ___zoomOutTime, float ___normalFOV, float ___zoomedFOV) { try { if (thisModEntry.Active && VRManager.IsVREnabled()) { VRTK_ControllerEvents secondaryEvents = VRTK_DeviceFinder.GetControllerRightHand(false).GetComponent <VRTK_ControllerEvents>(); Vector2 axis = secondaryEvents.GetAxis( VRTK_DeviceFinder.GetHeadsetType() == SDK_BaseHeadset.HeadsetType.WindowsMixedReality ? VRTK_ControllerEvents.Vector2AxisAlias.TouchpadTwo : VRTK_ControllerEvents.Vector2AxisAlias.Touchpad ); float zoomedFactor = ___normalFOV / ___zoomedFOV; if (axis.y < 0.625f && XRDevice.fovZoomFactor > 1f) { XRDevice.fovZoomFactor = Mathf.SmoothDamp(XRDevice.fovZoomFactor, 1.0f, ref ___currentZoomVelocity, ___zoomOutTime); } if (axis.y > 0.625f && XRDevice.fovZoomFactor < zoomedFactor) { XRDevice.fovZoomFactor = Mathf.SmoothDamp(XRDevice.fovZoomFactor, zoomedFactor, ref ___currentZoomVelocity, ___zoomInTime); } } } catch (Exception e) { Debug.LogError(string.Format("Exception thrown during CameraZoom.ZoomMechanic postfix patch:\n{0}", e.Message)); OnCriticalFailure(); } }
private void Update() { if (GetComponent <VRTK_ControllerEvents>().touchpadTouched) { lastTouchX = controllerEvents.GetAxis(VRTK_ControllerEvents.Vector2AxisAlias.Touchpad).x; } }
private void RControllerEvents_TouchpadReleased(object sender, ControllerInteractionEventArgs e) { Vector2 rCAxis = rControllerEvents.GetAxis(VRTK_ControllerEvents.Vector2AxisAlias.Touchpad); if (rCAxis.x > touchpadXDeadZone || rCAxis.x < -touchpadXDeadZone) { Debug.Log("NO"); if (rCAxis.x > touchpadXDeadZone) { uIHandler.ScrollShop(1); MouseScroll = 1; } else if (rCAxis.x < -touchpadXDeadZone) { uIHandler.ScrollShop(-1); MouseScroll = -1; } } }