Example #1
0
    void Update()
    {
        UpdateBuffers();

        FinchController controller = FinchController.GetController(Chirality);

        transform.position = Vector3.Lerp(GetMiddlePosition(), controller.Position, GetLerpPath());
        transform.rotation = controller.Rotation; //Quaternion.Lerp(GetMiddleRotation(), controller.Rotation, GetLerpPath());


        //log
        if (Chirality == FinchChirality.Left)
        {
            Chooser.Path = PositionBuffer + " " + GetLerpPath().ToString("f2");
        }

        if (FinchController.GetPressDown(FinchChirality.Any, FinchControllerElement.Trigger))
        {
            PositionBuffer++;
            PositionBuffer = Mathf.Clamp(PositionBuffer, 2, 10);
            positionBuffer = new Vector3[PositionBuffer];
        }

        if (FinchController.GetPressDown(FinchChirality.Any, FinchControllerElement.GripButton))
        {
            PositionBuffer--;
            PositionBuffer = Mathf.Clamp(PositionBuffer, 2, 10);
            positionBuffer = new Vector3[PositionBuffer];
        }
    }
    private bool anyWasPressedDown(FinchChirality chirality, FinchController controller)
    {
        for (int i = 0; i <= (int)FinchControllerElement.ButtonGrip; ++i)
        {
            if (controller.GetPressDown((FinchControllerElement)i))
            {
                return(true);
            }
        }

        if (controller.GetPressDown(FinchControllerElement.ButtonThumb))
        {
            return(true);
        }

        return(false);
    }
Example #3
0
    void Update()
    {
        FinchController controller = FinchVR.GetFinchController(Chirality);

        if (Input.GetKeyDown(KeyCode.A) || controller.GetPressDown(FinchControllerElement.ButtonThumb))
        {
            kk.enabled = false;
        }
    }
Example #4
0
    // Update is called once per frame
    void Update()
    {
        FinchController controller = FinchVR.GetFinchController(Chirality);

        if (Input.GetKeyDown(KeyCode.A) || controller.GetPressDown(FinchControllerElement.ButtonThumb))
        {
            //if (flag == 0) {
            setdrawnow(1);
            //}
            //flag++;
        }
        if (Input.GetKeyDown(KeyCode.B) || controller.GetPressDown(FinchControllerElement.IndexTrigger))
        {
            setdrawnow(2);
        }
        if (drawnow)
        {
            setline();
        }
    }
Example #5
0
    private void Update()
    {
        float y = Mathf.Lerp(MinY, MaxY, GetPoint(Points, (Time.time - startTime) / TimeToMove).y);

        transform.localPosition = new Vector3(transform.localPosition.x, y, transform.localPosition.z);

        bool bothPressed = FinchCore.NodesState.GetControllersCount() == 2 && FinchController.GetPressDown(FinchChirality.Both, FinchControllerElement.HomeButton);
        bool anyPressed  = FinchCore.NodesState.GetControllersCount() != 2 && FinchController.GetPressDown(FinchChirality.Any, FinchControllerElement.HomeButton);

        if (bothPressed || anyPressed)
        {
            startTime = Time.time;
        }
    }
Example #6
0
    void Update()
    {
        if (FinchController.GetPressDown(FinchChirality.Any, FinchControllerElement.AppButton))
        {
            UpdateState(TrackingType.Finch);
        }

        if (FinchController.GetPressDown(FinchChirality.Any, FinchControllerElement.ThumbButton))
        {
            UpdateState(TrackingType.Experimental);
        }

        Text.text = Path;
    }
    private void detectPress(FinchChirality chirality)
    {
        FinchController controller = chirality == FinchChirality.Right ? RightController : LeftController;
        FinchNodeType   nodeType   = chirality == FinchChirality.Right ? FinchNodeType.RightHand : FinchNodeType.LeftHand;
        bool            wasInvoked = false;

        if (FinchDownEvent != null && controller.GetPressDown(button))
        {
            FinchDownEvent.Invoke();
            wasInvoked = true;
        }

        if (FinchUpEvent != null && RightController.GetPressUp(button))
        {
            FinchUpEvent.Invoke();
            wasInvoked = true;
        }

        if (Vibration && wasInvoked)
        {
            FinchVR.HapticPulse(nodeType, VibrationTimeMs);
        }
    }
Example #8
0
    protected void TryLoadNextStep()
    {
        int upperArmsCount   = FinchCore.NodesState.GetUpperArmCount();
        int controllersCount = FinchCore.NodesState.GetControllersCount();

        bool skipDueCorrectSet = (FinchCore.Settings.ControllerType == FinchControllerType.Shift ? upperArmsCount + controllersCount == 4 : controllersCount == 2);
        bool skipDuePress      = false;
        bool isShift           = FinchCore.Settings.ControllerType == FinchControllerType.Shift;

        foreach (FinchControllerElement i in (FinchControllerElement[])Enum.GetValues(typeof(FinchControllerElement)))
        {
            bool enoughPressing = Math.Max(FinchController.Left.GetPressTime(i), FinchController.Right.GetPressTime(i)) > FinchCalibration.Settings.TimePressingToCallCalibration;
            bool isPressing     = FinchController.GetPressDown(FinchChirality.Any, i);

            skipDuePress |= i != FinchControllerElement.Touch && (isShift ? isPressing : enoughPressing);
        }

        if (skipDueCorrectSet || skipDuePress)
        {
            PlayableSet.RememberNodes();
            scannerStepPassOnce = true;
            NextStep();
        }
    }
Example #9
0
    private void VisualizeButtons()
    {
        if (controller.GetPressUp(FinchControllerElement.ButtonZero))
        {
            HighlightedCalibration.transform.localPosition = transformCalibration;
            Calibration.SetActive(true);
            HighlightedCalibration.SetActive(false);
        }
        else if (controller.GetPressDown(FinchControllerElement.ButtonZero))
        {
            HighlightedCalibration.SetActive(true);
            Calibration.SetActive(false);
            HighlightedCalibration.transform.localPosition += new Vector3(0, 0, -ButtonCoeff);
        }

        if (controller.GetPressUp(FinchControllerElement.ButtonOne))
        {
            HighlightedButtonOne.transform.localPosition = transformButtonOne;
            ButtonOne.SetActive(true);
            HighlightedButtonOne.SetActive(false);
        }
        else if (controller.GetPressDown(FinchControllerElement.ButtonOne))
        {
            ButtonOne.SetActive(false);
            HighlightedButtonOne.SetActive(true);
            HighlightedButtonOne.transform.localPosition -= new Vector3(0, 0, ButtonCoeff);
        }

        if (controller.GetPressUp(FinchControllerElement.ButtonTwo))
        {
            HighlightedButtonTwo.transform.localPosition = transformButtonTwo;
            ButtonTwo.SetActive(true);
            HighlightedButtonTwo.SetActive(false);
        }
        else if (controller.GetPressDown(FinchControllerElement.ButtonTwo))
        {
            HighlightedButtonTwo.SetActive(true);
            ButtonTwo.SetActive(false);
            HighlightedButtonTwo.transform.localPosition -= new Vector3(0, 0, ButtonCoeff);
        }
    }