private static bool GetResolvedNearTouchUp(NearTouch virtualMask, RawNearTouch rawMask, Controller controllerMask) { bool up = false; if ((controllerMask & Controller.Active) != 0) controllerMask |= activeControllerType; for (int i = 0; i < controllers.Count; i++) { OVRControllerBase controller = controllers[i]; if (ShouldResolveController(controller.controllerType, controllerMask)) { RawNearTouch resolvedMask = rawMask | controller.ResolveToRawMask(virtualMask); if (((RawNearTouch)controller.currentState.NearTouches & resolvedMask) != 0) { return false; } if ((((RawNearTouch)controller.currentState.NearTouches & resolvedMask) == 0) && (((RawNearTouch)controller.previousState.NearTouches & resolvedMask) != 0)) { up = true; } } } return up; }
private bool GetResolvedNearTouchDown(NearTouch virtualMask, RawNearTouch rawMask, ControllerType controllerMask) { if (!OVRManager.instance.isVRPresent) return false; bool down = false; if ((controllerMask & ControllerType.Active) != 0) controllerMask |= activeControllerType; for (int i = 0; i < controllers.Count; i++) { OVRControllerBase controller = controllers[i]; if (ShouldResolveController(controller.controllerType, controllerMask)) { RawNearTouch resolvedMask = rawMask | controller.ResolveToRawMask(virtualMask); if (((RawNearTouch)controller.previousInputState.NearTouches & resolvedMask) != 0) { return false; } if ((((RawNearTouch)controller.currentInputState.NearTouches & resolvedMask) != 0) && (((RawNearTouch)controller.previousInputState.NearTouches & resolvedMask) == 0)) { down = true; } } } return down; }
/// <summary> /// Gets the current up state of the given raw near touch mask with the given controller mask. /// Returns true if any masked near touch was released this frame on any masked controller and no other masked near touch is still down this frame. /// </summary> public static bool GetUp(RawNearTouch rawMask, Controller controllerMask = Controller.Active) { return GetResolvedNearTouchUp(NearTouch.None, rawMask, controllerMask); }
/// <summary> /// Gets the current up state of the given raw near touch mask with the given controller mask. /// Returns true if any masked near touch was released this frame on any masked controller and no other masked near touch is still down this frame. /// </summary> public static bool GetUp(RawNearTouch rawMask, ControllerType controllerMask) { return OVRManager.input.GetResolvedNearTouchUp(NearTouch.None, rawMask, controllerMask); }
/// <summary> /// Gets the current down state of the given raw near touch mask with the Active controller. /// Returns true if any masked near touch was pressed this frame on the Active controller and no masked near touch was previously down last frame. /// </summary> public static bool GetDown(RawNearTouch rawMask) { return OVRManager.input.GetResolvedNearTouchDown(NearTouch.None, rawMask, ControllerType.Active); }
private bool GetResolvedNearTouch(NearTouch virtualMask, RawNearTouch rawMask, Controller controllerMask) { if (!OVRManager.isHmdPresent) return false; if ((controllerMask & Controller.Active) != 0) controllerMask |= activeControllerType; for (int i = 0; i < controllers.Count; i++) { OVRControllerBase controller = controllers[i]; if (ShouldResolveController(controller.controllerType, controllerMask)) { RawNearTouch resolvedMask = rawMask | controller.ResolveToRawMask(virtualMask); if (((RawNearTouch)controller.currentInputState.NearTouches & resolvedMask) != 0) { return true; } } } return false; }
private bool GetResolvedNearTouchUp(NearTouch virtualMask, RawNearTouch rawMask, Controller controllerMask) { #if OVR_LEGACY if (!OVRManager.instance.isVRPresent) return false; #else if (!OVRManager.isHmdPresent) return false; #endif bool up = false; if ((controllerMask & Controller.Active) != 0) controllerMask |= activeControllerType; for (int i = 0; i < controllers.Count; i++) { OVRControllerBase controller = controllers[i]; if (ShouldResolveController(controller.controllerType, controllerMask)) { RawNearTouch resolvedMask = rawMask | controller.ResolveToRawMask(virtualMask); if (((RawNearTouch)controller.currentInputState.NearTouches & resolvedMask) != 0) { return false; } if ((((RawNearTouch)controller.currentInputState.NearTouches & resolvedMask) == 0) && (((RawNearTouch)controller.previousInputState.NearTouches & resolvedMask) != 0)) { up = true; } } } return up; }
/// <summary> /// Gets the current state of the given raw near touch mask with the given controller mask. /// Returns true if any masked near touch is down on any masked controllers. /// </summary> public static bool Get(RawNearTouch rawMask, Controller controllerMask = Controller.Active) { return OVRManager.input.GetResolvedNearTouch(NearTouch.None, rawMask, controllerMask); }