Example #1
0
        public static bool GetStickTouch(ControllerState4 controllerState)
        {
            RawTouch stickTouch      = RawTouch.LThumbstick | RawTouch.RThumbstick;
            bool     stickTouchValue = (controllerState.Touches & (uint)stickTouch) != 0;

            return(stickTouchValue);
        }
Example #2
0
        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);
 }
Example #4
0
    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();
    }
Example #5
0
	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;
	}
Example #6
0
	/// <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;
    }
Example #10
0
	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;
	}
Example #11
0
	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;
	}
Example #12
0
	/// <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);
	}
Example #13
0
 private bool ThisIsANewGesture(RawTouch touch)
 {
     return touch.phase == TouchPhase.Began;
 }