Exemple #1
0
        /// <summary>
        /// Updates the current BobState - <para></para>
        ///       <see cref="BobState.BOBBING"/> ,
        ///       <para>Updates the logic for moving you forward through the scene.</para>
        ///       <see cref="BobState.RECALIBRATING"/> ,
        ///       <para>Updates the logic for recalibrating the player height.</para>
        ///       <see cref="BobState.STILL"/>
        ///       <para>Updates the logic for standing still.</para>
        /// </summary>
        private void UpdateBobStates()
        {
            bobSpeed = (headVelocity.y < 0) ? (headVelocity.y * -1) * bobSpeedMultiplier : (headVelocity.y) * bobSpeedMultiplier;
//			Debug.Log(bobSpeed);
            switch (m_bobState)
            {
            case BobState.BOBBING:
                if (m_agent != null)
                {
                    if (moveDirSettings == eDirectionSettings.GAZE)
                    {
                        m_agent.Move(transform.forward * (0.5f * (bobSpeed)) * Time.deltaTime);
                    }
                    else if (moveDirSettings == eDirectionSettings.CONTROLLER)
                    {
                        m_agent.Move(m_activeController.GetFaceDirection() * (0.5f * (bobSpeed)) * Time.deltaTime);
                    }
                }
                break;

            //TODO: if both VIVE controller buttons are being pressed, move backwards
            case BobState.STILL: if (m_agent != null && m_agent.enabled)
                {
#if UNITY_5_6
                    m_agent.isStopped = true;
#else
                    m_agent.Stop();
#endif
                }
                break;
            }
        }
Exemple #2
0
        void UpdateMove()
        {
            Vector3 moveDir;

            if (m_directionMode == eMoveDirectionMode.GAZE)
            {
                moveDir = m_headRef.forward;
            }
            else
            {
                moveDir = m_activeController.GetFaceDirection();
            }

            if (m_activeController.GetButtonDown((Valve.VR.EVRButtonId)m_buttonToPress))
            {
                m_agent.Move(moveDir * m_runSpeed * Time.deltaTime);
            }
            else
            {
                m_agent.Move(moveDir * m_walkSpeed * Time.deltaTime);
            }
        }