void UpdateFlat() { if (Input.GetMouseButtonDown(0)) { teleporter.ToggleDisplay(true); } if (Input.GetMouseButtonUp(0)) { teleporter.Teleport(); teleporter.ToggleDisplay(false); } }
private void Update() { float left = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick).magnitude; float right = OVRInput.Get(OVRInput.Axis2D.SecondaryThumbstick).magnitude; if (left != 0) { leftCast = true; leftTeleporter.ToggleDisplay(true); } else if (leftCast) { leftCast = false; leftTeleporter.Teleport(); leftTeleporter.ToggleDisplay(false); } if (right != 0) { rightCast = true; rightTeleporter.ToggleDisplay(true); } else if (rightCast) { rightCast = false; rightTeleporter.Teleport(); rightTeleporter.ToggleDisplay(false); } }
//This function teleports the user to the target and gives them a height of 1.7. public void ExecuteTeleport() { teleporter.Teleport(); float height = (float)1.7; bodyTransform.position = bodyTransform.position + new Vector3(0, height, 0); }
private void Update() { stickvalue = -inputManager.stick.y; if (stickvalue > minStickValue) { if (Mathf.Abs(stickvaluePrev) < minStickValue && !isActive) { teleporter.ToggleDisplay(true); isActive = true; //Debug.Log("XRTeleporterController:: Enabled"); } strength = stickvalue; strength = Mathf.Clamp(strength, 0.1f, 1f); teleporter.strength = strength * distanceMult; } else if (isActive) { teleporter.ToggleDisplay(false); isActive = false; //Debug.Log("XRTeleporterController:: Disabled"); } if (isActive && inputManager.IsTriggerButtonUp()) { teleporter.Teleport(); teleporter.ToggleDisplay(false); StartCoroutine("_DisableTeleportTimed"); //Debug.Log("XRTeleporterController:: Disabled"); } stickvaluePrev = stickvalue; }
// Update is called once per frame void Update() { if (OVRInput.GetDown(OVRInput.Button.PrimaryThumbstick, OVRInput.Controller.LTouch)) { Debug.Log("Thumbstick Pressed"); teleporter.ToggleDisplay(true); } if (OVRInput.GetUp(OVRInput.Button.PrimaryThumbstick, OVRInput.Controller.LTouch)) { Debug.Log("Thumbstick released"); teleporter.Teleport(); teleporter.ToggleDisplay(false); } }
private void Update() { if (side == handSide.Right) { if (Input.GetButtonDown(trackPad)) { teleporter.ToggleDisplay(true); } if (Input.GetButtonUp(trackPad)) { teleporter.Teleport(); teleporter.ToggleDisplay(false); } } }
// Update is called once per frame void Update() { handTriggerState = OVRInput.Get(OVRInput.Axis1D.PrimaryHandTrigger, controller); if (rightHand) { primaryTouched = OVRInput.Get(OVRInput.Touch.One, controller); primaryDown = OVRInput.Get(OVRInput.Button.One, controller); //print("Touched: " + primaryTouched + "Presssed: " + primaryDown); if (primaryTouched) { teleporter.ToggleDisplay(false); teleporter.ToggleDisplay(true); } if (previousPrimaryTouched && !primaryTouched) { teleporter.ToggleDisplay(false); } if (!previousPrimaryDown && primaryDown) { teleporter.Teleport(); } previousPrimaryTouched = primaryTouched; previousPrimaryDown = primaryDown; } if (grabbingObject) { if (handTriggerState < 0.9f) { Release(); } } }
//로그 메시지를 보자 /*void showMeLog() * { * logTxt1.text = "카메라 rotation값 w,x,y,z \n" + Camera.rotation.w.ToString() + "\n" + * Camera.rotation.x.ToString() + "\n" + * Camera.rotation.y.ToString() + "\n" + * Camera.rotation.z.ToString(); * * logTxt2.text = "플레이어 rotation값 w,x,y,z \n" + player.transform.rotation.w.ToString() + "\n" + * player.transform.rotation.x.ToString() + "\n" + * player.transform.rotation.y.ToString() + "\n" + * player.transform.rotation.z.ToString(); * }*/ public void onStateChanged(int state) { if (!pauseMenu.activeInHierarchy) { this.state = state; if (state == 2) { point = Cursor.position; var forward = point - player.transform.position; point += forward; //player.transform.Translate(player.transform.GetChild(1).forward.normalized, Space.World); teleporter.Teleport(); //Cursor.gameObject.SetActive(state == 1); teleporter.ToggleDisplay(false); } //Cursor.gameObject.SetActive(state == 1); //teleporter.ToggleDisplay(false); } }
// Update is called once per frame void Update() { if (secondaryHand.collisionEnabled) { secondaryHand.DisableCollision(); } NVRInputDevice primaryInput = primaryHand.GetComponent <NVRInputDevice>(); NVRInputDevice secondaryInput = secondaryHand.GetComponent <NVRInputDevice>(); //Allow player to turn rapidly with secondary joystick float joystickX = secondaryHand.Inputs[NVRButtons.Touchpad].Axis.x; if (!justRotated && Mathf.Abs(joystickX) >= rotateThreshold) { float rotation = rotationAmount * Mathf.Sign(joystickX); player.transform.Rotate(new Vector3(0, rotation, 0)); justRotated = true; } else if (justRotated && Mathf.Abs(joystickX) < rotateThreshold) { justRotated = false; } //Allow "pulling" movement by gripping with secondary hand if (secondaryHand.HoldButtonDown) { //Set anchor prevHandPosition = secondaryHand.CurrentPosition; } else if (secondaryHand.HoldButtonPressed) { //Move player Vector3 delta = secondaryHand.transform.position - prevHandPosition; player.transform.Translate(-delta); } else { //Allow player to teleport with secondary hand if (secondaryHand.UseButtonDown) { teleporter.ToggleDisplay(true); } else if (secondaryHand.UseButtonUp) { float playerHeight = player.transform.position.y; teleporter.Teleport(); teleporter.ToggleDisplay(false); player.transform.position = new Vector3(player.transform.position.x, playerHeight, player.transform.position.z); } } //Pressing A resets player position if (primaryInput.GetPressDown(NVRButtons.A)) { player.transform.position = startingPosition; } //Terraform if (primaryHand.UseButtonDown && terraformController.isActiveAndEnabled) { terraformController.Click(); } }