void Update () { if (touchPad.GetAxis(handType).x < 0) { if(firstTouchPause) { firstTouchPause = false; manager.SetPause(!manager.pause); } } else firstTouchPause = true; if (touchPad.GetAxis(handType).x > 0) { if (firstTouchGrid) { firstTouchGrid = false; grid.SetActive(!grid.active); fileName.SetActive(!fileName.active); } } else firstTouchGrid = true; if (resetBtn.GetState(handType)) { if (firstTouchReset) { firstTouchReset = false; manager.Reset(); } } else firstTouchReset = true; }
public void ChangeSubtreeHeight(SteamVR_Action_Vector2 action) { if (selectedObj != null) { float yAxis = action.GetAxis(handType).y; if (yAxis > 0) { current += action.GetAxis(handType).y *Time.deltaTime; } else { current += -action.GetAxis(handType).y *Time.deltaTime; } if (current > threshold) { current = 0; if (yAxis > 0) { selectedObj.GetComponent <Linker>().container.IncrementSubtree(Linker.RenderMode.LEVELS); } else if (yAxis < 0) { selectedObj.GetComponent <Linker>().container.DecrementSubtree(Linker.RenderMode.LEVELS); } } } }
void Update() { touchpadLeft = touchPadAction.GetAxis(SteamVR_Input_Sources.LeftHand); touchpadRight = touchPadAction.GetAxis(SteamVR_Input_Sources.RightHand); touchpadDown = touchPadDownAction.GetState(SteamVR_Input_Sources.Any); playerBody.transform.position = new Vector3(playerCamera.transform.position.x, playerBody.transform.position.y, playerCamera.transform.position.z); if (touchpadDown) { // Handle movement via touchpad if (touchpadLeft.y > 0.2f || touchpadLeft.y < -0.2f) { // Move Forward player.transform.position += player.transform.forward * Time.deltaTime * (touchpadLeft.y * speed); } // handle rotation via touchpad if (touchpadLeft.x > 0.3f) { player.transform.position += player.transform.right * Time.deltaTime * (touchpadLeft.x * speed); } else if (touchpadLeft.x < -0.3f) { player.transform.position -= -player.transform.right * Time.deltaTime * (touchpadLeft.x * speed); } if (touchpadRight.x > 0.3f || touchpadRight.x < -0.3f) { player.transform.Rotate(0, touchpadRight.x * sensitivityX, 0); } } }
void FixedUpdate() { if (GameManager.isVREnable) { // Store the input axes. // changed the inputs so that u can use VR pads movementDir = new Vector3(inputL.GetAxis(VRInput).x, 0, inputL.GetAxis(VRInput).y); aimDir = new Vector3(inputR.GetAxis(VRInput).x, 0, inputR.GetAxis(VRInput).y); } else { // Joystick Input movementDir = new Vector3(Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical")); aimDir = new Vector3(Input.GetAxisRaw("AimX"), 0, Input.GetAxisRaw("AimY")); } // Move the player around the scene. if (movementDir != Vector3.zero) { Move(movementDir); } if (aimDir != Vector3.zero) { isAiming = true; Aim(aimDir); } else { isAiming = false; } // Animate the player. //Animating(h, v); }
//基本のアップデートでは、Touch座標の取得を行って、デバッグログを出力させています。 void Update() { for (int i = 0; i < m_Actions.Length; i++) { for (int h = 0; h < m_HandType.Length; h++) { //座標の取得 m_HandType[h].m_TouchPosX = m_actionVector2.GetAxis(m_HandType[h].m_HandType).x; m_HandType[h].m_TouchPosY = m_actionVector2.GetAxis(m_HandType[h].m_HandType).y; //以下デバッグログ用処理 //--------------------------------------------------------------------------------------------------------------- //何かボタンが押されていた時 if (GetVRButtonDown(m_HandType[h].m_HandName, m_Actions[i].m_ActionName)) { //Debug.Log(m_Actions[i].m_Action.GetShortName() + "のボタンが押された!"); Debug.Log(m_HandType[h].m_HandName + "の" + m_Actions[i].m_ActionName + "のボタンが押された!"); } //何かボタンが離されていた時 if (GetVRButtonUp(m_HandType[h].m_HandName, m_Actions[i].m_ActionName)) { //Debug.Log(m_Actions[i].m_Action.GetShortName() + "のボタンが離された!"); Debug.Log(m_HandType[h].m_HandName + "の" + m_Actions[i].m_ActionName + "のボタンが離された!"); } //--------------------------------------------------------------------------------------------------------------- } } }
void FixedUpdate() { if (player == null) { Debug.Log("Player is null!"); return; } touchpadLeft = touchpadAction.GetAxis(SteamVR_Input_Sources.LeftHand); touchpadRight = touchpadAction.GetAxis(SteamVR_Input_Sources.RightHand); touchpadLeftDown = touchpadButtonAction.GetStateDown(SteamVR_Input_Sources.LeftHand); touchpadRightDown = touchpadButtonAction.GetStateDown(SteamVR_Input_Sources.RightHand); // LEFT if (player.leftHand != null) { Quaternion orientation = Camera.main.transform.rotation; Vector3 moveDirection = orientation * Vector3.forward * touchpadLeft.y + orientation * Vector3.right * touchpadLeft.x; Vector3 pos = player.transform.position; pos.x += moveDirection.x * moveSpeed * Time.deltaTime; pos.z += moveDirection.z * moveSpeed * Time.deltaTime; player.transform.position = pos; } // RIGHT if (player.rightHand != null) { // Jumping if (resolver.isGrounded && touchpadRightDown && touchpadRight.y > 0.5f) { Jump(); } // Rotation if (comfortTurning && touchpadRightDown) { if (touchpadRight.x > 0.3f) { transform.RotateAround(head.position, Vector3.up, comfortTurnDegrees); } else if (touchpadRight.x < -0.3f) { transform.RotateAround(head.position, Vector3.up, -comfortTurnDegrees); } } else if (!comfortTurning) { if (touchpadRight.x > 0.3f) { transform.RotateAround(head.position, Vector3.up, turnSpeed * Time.deltaTime); } else if (touchpadRight.x < -0.3f) { transform.RotateAround(head.position, Vector3.up, -turnSpeed * Time.deltaTime); } } } }
// Stylus. public float GetAxis(StylusAxisInput stylusAxisInput) { SteamVR_Action_Single actionSinglePrimary; SteamVR_Action_Single actionSingleNib; if (_touchStripRejection && _stylusAxisToSteamVrMap.TryGetValue(StylusAxisInput.Primary, out actionSinglePrimary) && _stylusAxisToSteamVrMap.TryGetValue(StylusAxisInput.Tip, out actionSingleNib)) { UpdateStateMachine(actionSinglePrimary.GetAxis(InputSource), actionSingleNib.GetAxis(InputSource), _touchpadValue.GetAxis(InputSource).x, _touchpadValue.GetAxis(InputSource).y); } if (stylusAxisInput == StylusAxisInput.TrackpadX && GetRejectionStatus(stylusAxisInput)) { return(_touchpadValue.GetAxis(InputSource).x); } if (stylusAxisInput == StylusAxisInput.TrackpadY && GetRejectionStatus(stylusAxisInput)) { return(_touchpadValue.GetAxis(InputSource).y); } SteamVR_Action_Single actionSingle; if (_stylusAxisToSteamVrMap.TryGetValue(stylusAxisInput, out actionSingle) && GetRejectionStatus(stylusAxisInput)) { return(actionSingle.GetAxis(InputSource)); } return(0); }
private void Update() { if (SteamVR_Input._default.inActions.UsePowerUp.GetStateDown(SteamVR_Input_Sources.RightHand)) { if (HasPowerup()) { UsePortal(); m_NumPortals--; } } float currYInput = walkAction.GetAxis(SteamVR_Input_Sources.LeftHand).y; float currXInput = walkAction.GetAxis(SteamVR_Input_Sources.LeftHand).x; if (currYInput != 0f || currXInput != 0) { Quaternion orientation = Camera.main.transform.rotation; var touchPadVector = walkAction.GetAxis(SteamVR_Input_Sources.LeftHand); Vector3 moveDirection = orientation * Vector3.forward * touchPadVector.y + orientation * Vector3.right * touchPadVector.x; Vector3 pos = transform.position; pos.x += moveDirection.x * m_PlayerMoveSpeed * Time.deltaTime; pos.z += moveDirection.z * m_PlayerMoveSpeed * Time.deltaTime; transform.position = pos; } //if (m_UsePowerUpAction) //{ // print("usingActionButton"); //} }
public void VRCameraTransition() //VRCamera 오브젝트의 위치를 변경하는 함수 { float _triggerAxis = _triggerVector1.GetAxis(SteamVR_Input_Sources.RightHand); if (_triggerAxis > 0.6f) { float _rotateSpeed = 100f; float _rotateDirection = _joystickVector2.GetAxis(SteamVR_Input_Sources.RightHand).x; _VRCameraTransform.LookAt(_centerAxis); //중심 축을 바라봄 _VRCameraTransform.Translate(_rotateDirection * Time.deltaTime * _rotateSpeed, 0f, 0f); //카메라 이동 } else { _centerAxis = _VRCameraTransform.position + _VRCameraTransform.forward * 50f; //중심 축 지정 float _moveSpeed = 100f; float _moveDirection = _joystickVector2.GetAxis(SteamVR_Input_Sources.RightHand).y; if (Mathf.Abs(_moveDirection) > 0.3f) { _VRCameraTransform.position += _target.GetComponent <Transform>().forward *Time.deltaTime *_moveSpeed *_moveDirection; } float _rotateSpeed = 100f; float _rotateDirection = _joystickVector2.GetAxis(SteamVR_Input_Sources.RightHand).x; if (Mathf.Abs(_rotateDirection) > 0.3f) { _VRCameraTransform.Rotate(0f, _rotateSpeed * _rotateDirection * Time.deltaTime, 0f); } } }
// Update is called once per frame void Update() { var yAxis = _Touchpad.GetAxis(_Hand).y; var xAxis = _Touchpad.GetAxis(_Hand).x; transform.position += (InsertCamHere.transform.right * xAxis * speed + InsertCamHere.transform.forward * yAxis * speed) * Time.deltaTime; transform.position = new Vector3(transform.position.x, 0, transform.position.z); }
private void Update() { if (m_IsEnter) { foreach (var hand in Player.instance.hands) { slider.value += moveAction.GetAxis(hand.handType).y * 0.1f * -1; } } }
// Update is called once per frame void Update() { if (_omni.enabled && !_omni.omniFound) { _omni.enabled = false; } var pos = HeadPosition.position - transform.position; pos.y = 0.5f; _controller.center = pos; yVel -= 9.8 * Time.deltaTime * 0.1; if (_controller.isGrounded) { yVel = 0; } var rotationSpeed = movement.GetAxis(handType).x; if (Mathf.Abs(rotationSpeed) < 0.1) { rotationSpeed = 0; } var speed = movement.GetAxis(handType).y; if (Mathf.Abs(speed) < 0.1) { speed = 0; } var direction = HeadPosition.forward * speed * 4 * Time.deltaTime; direction.y = (float)yVel; _controller.Move(direction); // Omni movement if (_omni.omniFound) { _omni.GetOmniInputForCharacterMovement(); if (_omni.GetForwardMovement() != Vector3.zero) { _controller.Move(_omni.GetForwardMovement()); } if (_omni.GetStrafeMovement() != Vector3.zero) { _controller.Move(_omni.GetStrafeMovement()); } } //transform.Rotate(new Vector3(0, rotationSpeed * speed * 100 * Time.deltaTime, 0)); }
// Initalizes point1 's curve void setCurveControlPoint() { #if SteamVR_Legacy // Will use touchpads to calculate touchpoint deviceL = SteamVR_Controller.Input((int)trackedObjL.index); deviceR = SteamVR_Controller.Input((int)trackedObjR.index); Vector2 touchpadL = (deviceL.GetAxis(EVRButtonId.k_EButton_Axis0)); // Getting reference to the touchpad Vector2 touchpadR = (deviceR.GetAxis(EVRButtonId.k_EButton_Axis0)); // Getting reference to the touchpad #elif SteamVR_2 Vector2 touchpadL = (m_touchpadAxis.GetAxis(trackedObjL.inputSource)); // Getting reference to the touchpad Vector2 touchpadR = (m_touchpadAxis.GetAxis(trackedObjL.inputSource)); // Getting reference to the touchpad #else //not supported without SteamVR Vector2 touchpadL = Vector2.zero; Vector2 touchpadR = Vector2.zero; #endif // Set the controllable distance to be the distance between the end of laser to back remote float distanceToMoveControlPoint = Vector3.Distance(point2, trackedObjR.transform.position); if (float.IsNaN(distanceToMoveControlPoint)) { // error with calculation will return return; } // Checking touchpad L float xvalL = touchpadL.x; float yvalL = touchpadL.y; // Checking touchpad R float xvalR = touchpadR.x; float yvalR = touchpadR.y; // getting between the front of the flexible pointer to the back of the remotes Vector3 forwardBetweenRemotes = point2 - trackedObjR.transform.position; Vector3 middleOfRemotes = (point2 + trackedObjR.transform.position) / 2f; // moving along y axis acording to R y controlPoint.transform.position = vectorDistanceAlongFoward(distanceToMoveControlPoint * (yvalR), middleOfRemotes, forwardBetweenRemotes); // now need to move left and right by getting the side vector forward Vector3 sideForward = Vector3.Cross(forwardBetweenRemotes, Vector3.up); controlPoint.transform.position = vectorDistanceAlongFoward(distanceToMoveControlPoint * (xvalR * -1), controlPoint.transform.position, sideForward); // now need to control depth using the other controller controlPoint.transform.position = vectorDistanceAlongFoward(distanceToMoveControlPoint * (yvalL), controlPoint.transform.position, Vector3.up); // setting the actual bezier curve point to follow control point point1 = controlPoint.transform.position; }
private void UpdatePov2() { if (pov2Touch.GetState(SteamVR_Input_Sources.RightHand)) { currPov2Pos = pov2Pos.GetAxis(SteamVR_Input_Sources.RightHand); if (pov2Touched) { return; } pov2Touched = true; lastPov2Pos = pov2Pos.GetAxis(SteamVR_Input_Sources.RightHand); } else { pov2Touched = false; var dir = (currPov2Pos - lastPov2Pos).normalized; if (dir == Vector2.zero) { return; } if (Math.Abs(dir.x) > Math.Abs(dir.y)) { if (dir.x >= 0) { output.SetButton((uint)ActionMappings.Pov2Right, true); StartCoroutine(UnpressPov2Button(0.1f, ActionMappings.Pov2Right)); } else { output.SetButton((uint)ActionMappings.Pov2Left, true); StartCoroutine(UnpressPov2Button(0.1f, ActionMappings.Pov2Left)); } } else { if (dir.y >= 0) { output.SetButton((uint)ActionMappings.Pov2Up, true); StartCoroutine(UnpressPov2Button(0.1f, ActionMappings.Pov2Up)); } else { output.SetButton((uint)ActionMappings.Pov2Down, true); StartCoroutine(UnpressPov2Button(0.1f, ActionMappings.Pov2Down)); } } } }
private void Update() { if (touchPad.GetAxis(SteamVR_Input_Sources.Any) != Vector2.zero) { Movement = touchPad.GetAxis(SteamVR_Input_Sources.Any); } Jump = trigger[SteamVR_Input_Sources.Any].stateDown; OpenMenu = locPush[SteamVR_Input_Sources.Any].stateDown; LeftGrab = grab[SteamVR_Input_Sources.LeftHand].stateDown; RightGrab = grab[SteamVR_Input_Sources.RightHand].stateDown; LeftGrabLetGo = grab[SteamVR_Input_Sources.LeftHand].stateUp; RightGrabLetGo = grab[SteamVR_Input_Sources.RightHand].stateUp; }
protected void Process(bool currentlyFalling, bool modifierActive) { if (isHeightOnly) { Vector2 axisDirection = Vector2.up * touchpadAxis.GetAxis(leftOrRightHand).y; currentSpeed = CalculateSpeed(axisDirection.magnitude, currentlyFalling, modifierActive); Move(axisDirection); } else { Vector2 axisDirection = touchpadAxis.GetAxis(leftOrRightHand); currentSpeed = CalculateSpeed(axisDirection.magnitude, currentlyFalling, modifierActive); Move(axisDirection); } }
private void updateInput() { if (TrackpadAction.GetActive(MovementHand)) { trackpad = TrackpadAction.GetAxis(MovementHand); } }
private void MoveMapCamera() { Vector3 orientationEuler = new Vector3(0, transform.eulerAngles.y, 0); Quaternion orientation = Quaternion.Euler(orientationEuler); Vector3 movement = Vector3.zero; float m_Speed = 0; Vector2 padPos = m_MoveValue.GetAxis(SteamVR_Input_Sources.LeftHand); float triggerValue = m_MovePress.GetAxis(SteamVR_Input_Sources.LeftHand); // If not pressing button if (triggerValue == 0.0f) { m_Speed = 0; } // If pressing touchpad if (triggerValue >= 0.0f) { m_Speed = 2.5f; MapCamera.transform.Translate(Vector3.up * m_Speed * padPos.y, Space.Self); MapCamera.transform.Translate(Vector3.right * m_Speed * padPos.x, Space.Self); FixedMapCamera.transform.position += m_Speed * new Vector3(padPos.x, 0, padPos.y); } // 調整mapCamera角度與頭朝向一致 float fpsRot = FPSCamera.transform.eulerAngles.y; Vector3 mapRot = MapCamera.transform.eulerAngles; MapCamera.transform.rotation = Quaternion.Euler(mapRot.x, fpsRot, 0); }
void Update() { // 왼손 컨트롤러의 트리거 버튼을 클릭했을 때 발생 if (trigger.GetStateDown(leftHand)) { Debug.Log("Clicked Trigger Button"); haptic.Execute(0.2f, 0.3f, 120.0f, 0.5f, leftHand); } // 오른손 컨트롤러의 트리거 버튼을 릴리스했을 때 발생 if (trigger.GetStateUp(rightHand)) { Debug.Log("Release Trigger Button"); } // 트랙패드 클릭 if (trackPadClick.GetStateDown(any)) { Debug.Log("TrackPad Click"); } if (trackPadTouch.GetState(any)) { Vector2 pos = trackPadPosition.GetAxis(any); Debug.Log($"Touch Pos x={pos.x}/y={pos.y}"); } }
/// <summary> /// Called once a frame. /// Used for getting input and what to do with it. /// </summary> void Update() { if (SteamVR_Input._default.inActions.Teleport.GetStateDown(SteamVR_Input_Sources.Any)) { player.Teleport(); } float triggerValue = squeezeAction.GetAxis(SteamVR_Input_Sources.Any); if (triggerValue > 0.01f) { } Vector2 touchpadValue = touchPadAction.GetAxis(SteamVR_Input_Sources.Any); if (touchpadValue != Vector2.zero) { } if (equipped) { if (SteamVR_Input._default.inActions.Draw.GetLastStateUp(SteamVR_Input_Sources.RightHand) && drawing) { Check(); if (drawingParticles) { drawingParticles.SetActive(false); } drawing = false; } } }
private void OnTriggerStay(Collider other) { //do group collision during controller collision GameObject collider = other.gameObject; if (collider.name == "Controller (left)" && selection.selectionMode == true) { if (SteamVR_Input._default.inActions.PickColor.GetStateDown(SteamVR_Input_Sources.LeftHand)) { //respond to trackpad clicks SteamVR_Action_Vector2 trackpadPos = SteamVR_Input._default.inActions.TouchPosition; Vector2 pos = trackpadPos.GetAxis(SteamVR_Input_Sources.LeftHand); double angle = Mathf.Rad2Deg * (Mathf.Atan(pos.y / pos.x)); if (pos.x < 0 && angle > -36 && angle < 90) //orange { toggleActive(orangeMarker, orangeGroup); } else if (pos.x > 0 && angle < 36 && angle > -90) //green { toggleActive(greenMarker, greenGroup); } else //blue { toggleActive(blueMarker, blueGroup); } } } }
//플레이어 VR이동 private void VRMove() { Vector2 pos; float moveX = 0; float moveZ = 0; if (trackPadClick.GetState(leftHand)) { pos = trackPadPosition.GetAxis(leftHand); moveX = pos.x; moveZ = pos.y; } else if (trackPadClick.GetStateUp(leftHand)) { moveX = 0; moveZ = 0; } Vector3 moveHorizontal = transform.right * moveX; Vector3 moveVertical = transform.forward * moveZ; velocity = (moveHorizontal + moveVertical).normalized * speed; if (velocity.magnitude <= 0.01f) { isWalk = false; } else if (!isRun) { isWalk = true; } rig.MovePosition(transform.position + velocity * Time.deltaTime); animator.SetBool("Run", isRun); currentRifle.animator.SetBool("Run", isRun); animator.SetBool("Walk", isWalk); currentRifle.animator.SetBool("Walk", isWalk); }
public float cursorSpeed = 20f; // Decrease to make faster, Increase to make slower private void PadScrolling() { #if SteamVR_Legacy if (controller.GetAxis().y != 0) { extendDistance += controller.GetAxis().y / cursorSpeed; moveCursorPosition(); } #elif SteamVR_2 if (m_touchpadAxis.GetAxis(trackedObj.inputSource).y != 0) { extendDistance += m_touchpadAxis.GetAxis(trackedObj.inputSource).y / cursorSpeed; moveCursorPosition(); } #endif }
private void PadScrolling() { #if SteamVR_Legacy if (controller.GetAxis().y != 0) { float touchpadAngle = CalculateTouchpadAxisAngle(controller.GetAxis()); ChangedHueSaturation(controller.GetAxis(), touchpadAngle); } #elif SteamVR_2 if (m_touchpadAxis.GetAxis(trackedObj.inputSource).y != 0) { float touchpadAngle = CalculateTouchpadAxisAngle(m_touchpadAxis.GetAxis(trackedObj.inputSource)); ChangedHueSaturation(m_touchpadAxis.GetAxis(trackedObj.inputSource), touchpadAngle); } #endif }
// Update is called once per frame // Gets input of controllers and handles it. // Same Controller Input handled depending on if user is in menu or not. void Update() { menuPressed = menu.GetStateDown(SteamVR_Input_Sources.LeftHand); if (menuPressed) { OpenCloseMenu(); } if (inMenu) { down = scrollDown.GetState(SteamVR_Input_Sources.RightHand); up = scrollUp.GetState(SteamVR_Input_Sources.RightHand); if (down || up) { scroll(); } } else { touchValue = touchpad.GetAxis(SteamVR_Input_Sources.RightHand); controlPressed = touchPressed.GetState(SteamVR_Input_Sources.RightHand); interactUI = locked.GetStateDown(SteamVR_Input_Sources.RightHand); if (interactUI) { lockUnlock(); } } }
// Update is called once per frame void Update() { //Menu button true/false if (SteamVR_Actions._default.Menu.GetStateDown(SteamVR_Input_Sources.Any)) { print("Menu down"); } //Teleport button true/false if (SteamVR_Actions._default.Teleport.GetStateDown(SteamVR_Input_Sources.Any)) { print("Teleport down"); //Toucpad location Vector2 touchPadValue = touchPadAction.GetAxis(SteamVR_Input_Sources.Any); if (touchPadValue != Vector2.zero) { print(touchPadValue); } } //Trigger button true/false if (SteamVR_Actions._default.GrabPinch.GetStateDown(SteamVR_Input_Sources.Any)) { print("Trigger down"); //Triggerbutton Strength float triggervalue = squeezeAction.GetAxis(SteamVR_Input_Sources.Any); if (triggervalue >= 0.0f) { print(triggervalue); } } }
private void Update() { if (interactable.attachedToHand) { hand = interactable.attachedToHand.handType; Vector2 m = a_move.GetAxis(hand); movement = new Vector3(m.x, 0, m.y); jump = a_jump.GetStateDown(hand); glow = Mathf.Lerp(glow, a_jump.GetState(hand) ? 1.5f : 1.0f, Time.deltaTime * 20); } else { movement = Vector2.zero; jump = false; glow = 0; } Joystick.localPosition = movement * joyMove; float rot = transform.eulerAngles.y; movement = Quaternion.AngleAxis(rot, Vector3.up) * movement; jumpHighlight.sharedMaterial.SetColor("_EmissionColor", Color.white * glow); character.Move(movement * 2, jump); }
// Update is called once per frame void Update() { // 왼손 컨트롤러 트리거를 눌렀을 때 if (trigger.GetStateDown(leftHand)) { Debug.Log("click left trigger"); haptic.Execute(0.2f, 0.5f, 200.0f, 1f, leftHand); //웨이팅 타임 지속시간, 주파수, 진폭 } //오른손 컨트롤러 트리거를 눌렀다가 떼었을때 if (trigger.GetStateUp(rightHand)) { Debug.Log("Released Triiger button"); haptic.Execute(0.2f, 0.5f, 200.0f, 1f, rightHand); //웨이팅 타임 지속시간, 주파수, 진폭 } if (trackPadCilck.GetStateDown(any)) { Debug.Log("TrackPad Click"); } if (trackPadTouch.GetState(any)) { Vector2 pos = trackPadPosition.GetAxis(any); Debug.Log($"Touch pos x= {pos.x}/y={pos.y}"); } }
void Update() { if (SteamVR_Input._default.inActions.Teleport.GetStateDown(SteamVR_Input_Sources.Any)) { // print("Teleport down"); } if (SteamVR_Input._default.inActions.GrabPinch.GetStateUp(SteamVR_Input_Sources.Any)) { // print("Grab pinch down"); } if (SteamVR_Input._default.inActions.GrabPinch.GetStateUp(SteamVR_Input_Sources.Any)) { // print("Grab pinch up"); } float triggerValue = squeezeAction.GetAxis(SteamVR_Input_Sources.Any); if (triggerValue > 0f) { //print("Trigger value: " + triggerValue); } Vector2 touchpadValue = touchPadAction.GetAxis(SteamVR_Input_Sources.Any); if (touchpadValue != Vector2.zero) { //print("Touchpad value: " + touchpadValue); } }
public override void Update() { bool active = CheckActive(action, actionCanvas.handType); if (active) { Vector2 actionAxis = action.GetAxis(actionCanvas.handType); if (elementAxis != actionAxis || initialAxisSet == false) { Color newColor; if (actionAxis == Vector2.zero) { newColor = actionCanvas.offColor; } else { newColor = actionCanvas.onColor; } SetFillColor(newColor); SetPosition(actionAxis); elementAxis = actionAxis; initialAxisSet = true; } } }