// Update is called once per frame private void Update() { RotateView(); // the jump state needs to read here to make sure it is not missed if (!m_Jump) { //m_Jump = CrossPlatformInputManager.GetButtonDown("Jump"); if (!UnityEngine.XR.XRDevice.isPresent) { m_Jump = Input.GetKeyDown(KeyBindingScript.buttons["Jump"]) || Input.GetKeyDown(KeyBindingScript.controller["C_Jump"]); } else { m_Jump = KeyBindingScript.JumpPressedVR(); } } if (!m_PreviouslyGrounded && m_CharacterController.isGrounded) { StartCoroutine(m_JumpBob.DoBobCycle()); PlayLandingSound(); m_MoveDir.y = 0f; m_Jumping = false; } if (!m_CharacterController.isGrounded && !m_Jumping && m_PreviouslyGrounded) { m_MoveDir.y = 0f; } m_PreviouslyGrounded = m_CharacterController.isGrounded; }
void Update() { if (!jumpPushed) { if (KeyBindingScript.LeftController != null && KeyBindingScript.RightController != null) { jumpPushed = KeyBindingScript.JumpPressedVR(); } else { jumpPushed = false; } } if (!wasGrounded && controller.isGrounded) { yVelocity = 0f; IsJumping = false; } if (!controller.isGrounded && !IsJumping && wasGrounded) { yVelocity = 0f; } wasGrounded = controller.isGrounded; }