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 void detectPress(FinchChirality chirality) { FinchController controller = chirality == FinchChirality.Right ? RightController : LeftController; FinchNodeType nodeType = chirality == FinchChirality.Right ? FinchNodeType.RightHand : FinchNodeType.LeftHand; bool wasInvoked = false; if (FinchUpEvent != null && (!ExceptCalibrationButton && (FinchVR.State.CalibrationButtonPressed[(int)chirality] || FinchVR.WasCalibratedRight)) || anyWasPressedUp(chirality, controller)) { FinchUpEvent.Invoke(); wasInvoked = true; } if (FinchDownEvent != null && anyWasPressedDown(FinchChirality.Right, controller)) { FinchDownEvent.Invoke(); wasInvoked = true; } if (Vibration && wasInvoked) { FinchVR.HapticPulse(nodeType, VibrationTimeMs); } }
void Update() { controller = Chirality == FinchChirality.Left ? FinchVR.LeftController : FinchVR.RightController; VisualizeButtons(); VisualizeTriggers(); VisualizeStick(); }
void Update() { FinchController controller = FinchVR.GetFinchController(Chirality); if (Input.GetKeyDown(KeyCode.A) || controller.GetPressDown(FinchControllerElement.ButtonThumb)) { kk.enabled = false; } }
void Update() { FinchController controller = FinchController.Left.IsConnected ? FinchController.Left : FinchController.Right; FinchChirality chirality = FinchCore.GetCapacitySensor(controller.Node); if (chirality == FinchChirality.Left || chirality == FinchChirality.Right) { LeftHand.SetActive(chirality == FinchChirality.Left); RightHand.SetActive(chirality == FinchChirality.Right); } }
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; } }
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 bool anyWasPressedUp(FinchChirality chirality, FinchController controller) { for (int i = 0; i <= (int)FinchControllerElement.ButtonGrip; ++i) { if (controller.GetPressUp((FinchControllerElement)i)) { return(true); } } if (controller.GetPressUp(FinchControllerElement.ButtonThumb)) { return(true); } return(false); }
// 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(); } }
// Update is called once per frame void Update() { FinchController controller = FinchVR.GetFinchController(Chirality); if (flag == 0) { setdrawnow(1); } flag++; if (flag == 65536) { flag = 1; } if (Input.GetKeyDown(KeyCode.B) || controller.GetPress(FinchControllerElement.ButtonThumb)) { setdrawnow(2); } if (drawnow) { setline(); } }
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); } }
private void DetectLongTap(FinchButtonEventType buttonEventType) { FinchController controller = buttonEventType == FinchButtonEventType.Right ? RightController : LeftController; int ind = buttonEventType == FinchButtonEventType.Right ? 0 : 1; if (controller.GetPress(FinchControllerElement.Touchpad)) { if (!isPressed[ind]) { isPressed[ind] = true; stopWatch = new System.Diagnostics.Stopwatch(); stopWatch.Start(); } else { if (!alreadyInvoked[ind] && stopWatch.ElapsedMilliseconds >= longTapTimeMs) { stopWatch.Stop(); alreadyInvoked[ind] = true; LongTapEvent.Invoke(); if (Vibration) { FinchVR.HapticPulse(ind == 0 ? FinchNodeType.RightHand : FinchNodeType.LeftHand, VibrationTimeMs); } } } } else { if (isPressed[ind]) { isPressed[ind] = alreadyInvoked[ind] = false; stopWatch.Stop(); } } }
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(); } }
protected virtual void Update() { RightController = FinchVR.RightController; LeftController = FinchVR.LeftController; }