public static bool GetStickTouch(ControllerState4 controllerState) { RawTouch stickTouch = RawTouch.LThumbstick | RawTouch.RThumbstick; bool stickTouchValue = (controllerState.Touches & (uint)stickTouch) != 0; return(stickTouchValue); }
public static bool GetThumbRest(ControllerState4 controllerState) { RawTouch touchMask = RawTouch.LThumbRest | RawTouch.RThumbRest; bool touch = (controllerState.Touches & (uint)touchMask) != 0; return(touch); }
public void AppendInput(RawTouch input) { if (inputHistory.Count == 0) { timeOffset = input.time; } input.time -= timeOffset; inputHistory.Add(input); }
public void AddToTrail(RawTouch touch) { if (_trailVerts.Count == 0) { _trailVerts.Add(V2toV3(touch.position, -100)); } else { var newPoint = V2toV3(touch.position, -100); var endPoint = _trailVerts[_trailVerts.Count - 1]; if (Vector3.Distance(endPoint, newPoint) > 2) { _trailVerts.Add(newPoint); } } DrawTrail(); }
private static bool GetResolvedTouchUp(Touch virtualMask, RawTouch 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)) { RawTouch resolvedMask = rawMask | controller.ResolveToRawMask(virtualMask); if (((RawTouch)controller.currentState.Touches & resolvedMask) != 0) { return false; } if ((((RawTouch)controller.currentState.Touches & resolvedMask) == 0) && (((RawTouch)controller.previousState.Touches & resolvedMask) != 0)) { up = true; } } } return up; }
/// <summary> /// Gets the current up state of the given raw touch mask with the given controller mask. /// Returns true if any masked touch was released this frame on any masked controller and no other masked touch is still down this frame. /// </summary> public static bool GetUp(RawTouch rawMask, Controller controllerMask = Controller.Active) { return GetResolvedTouchUp(Touch.None, rawMask, controllerMask); }
/// <summary> /// Gets the current up state of the given raw touch mask with the given controller mask. /// Returns true if any masked touch was released this frame on any masked controller and no other masked touch is still down this frame. /// </summary> public static bool GetUp(RawTouch rawMask, ControllerType controllerMask) { return OVRManager.input.GetResolvedTouchUp(Touch.None, rawMask, controllerMask); }
/// <summary> /// Gets the current down state of the given raw touch mask with the Active controller. /// Returns true if any masked touch was pressed this frame on the Active controller and no masked touch was previously down last frame. /// </summary> public static bool GetDown(RawTouch rawMask) { return OVRManager.input.GetResolvedTouchDown(Touch.None, rawMask, ControllerType.Active); }
private bool GetResolvedTouchDown(Touch virtualMask, RawTouch 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)) { RawTouch resolvedMask = rawMask | controller.ResolveToRawMask(virtualMask); if (((RawTouch)controller.previousInputState.Touches & resolvedMask) != 0) { return false; } if ((((RawTouch)controller.currentInputState.Touches & resolvedMask) != 0) && (((RawTouch)controller.previousInputState.Touches & resolvedMask) == 0)) { down = true; } } } return down; }
private bool GetResolvedTouch(Touch virtualMask, RawTouch 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)) { RawTouch resolvedMask = rawMask | controller.ResolveToRawMask(virtualMask); if (((RawTouch)controller.currentInputState.Touches & resolvedMask) != 0) { return true; } } } return false; }
private bool GetResolvedTouchUp(Touch virtualMask, RawTouch 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)) { RawTouch resolvedMask = rawMask | controller.ResolveToRawMask(virtualMask); if (((RawTouch)controller.currentInputState.Touches & resolvedMask) != 0) { return false; } if ((((RawTouch)controller.currentInputState.Touches & resolvedMask) == 0) && (((RawTouch)controller.previousInputState.Touches & resolvedMask) != 0)) { up = true; } } } return up; }
/// <summary> /// Gets the current state of the given raw touch mask with the given controller mask. /// Returns true if any masked touch is down on any masked controllers. /// </summary> public static bool Get(RawTouch rawMask, Controller controllerMask = Controller.Active) { return OVRManager.input.GetResolvedTouch(Touch.None, rawMask, controllerMask); }
private bool ThisIsANewGesture(RawTouch touch) { return touch.phase == TouchPhase.Began; }