void Update() { if (MyOVRInput.Get(OVRInput.Touch.PrimaryTouchpad)) { Vector2 axis = MyOVRInput.Get(OVRInput.Axis2D.PrimaryTouchpad); if (MyOVRInput.Get(OVRInput.Button.PrimaryIndexTrigger)) { // トリガーを押しているときは上下 _moveTarget.position += Vector3.up * (axis.y * _maxSpeed * Time.deltaTime); } else { // それ以外は前後左右 Transform camera = Camera.main.transform; _moveTarget.position += NormalizedLandscape(camera.rotation * Vector3.right) * (axis.x * _maxSpeed * Time.deltaTime); _moveTarget.position += NormalizedLandscape(camera.rotation * Vector3.forward) * (axis.y * _maxSpeed * Time.deltaTime); } } }
void Update() { if (MyOVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger)) { Transform controller = MyOVRRayHelper.GetController(); _basePos = controller.rotation * Vector3.forward; } if (MyOVRInput.Get(OVRInput.Button.PrimaryIndexTrigger)) { Transform controller = MyOVRRayHelper.GetController(); Vector3 currPos = controller.rotation * Vector3.forward; Vector3 diffVec = currPos - _basePos; float normalizedMagnitute = Mathf.InverseLerp(0f, SQRT2, diffVec.magnitude); if (normalizedMagnitute > 0.05f) { _moveTarget.position += NormalizedLandscape(diffVec) * (normalizedMagnitute * _maxSpeed * Time.deltaTime); } } }