Ejemplo n.º 1
0
        void AllowBehindCam()
        {
            Vector3 target;

            //Looking behind
            if (m_mainPlayer.GetRewiredPlayer().GetButton("Look Behind"))
            {
                StopCoroutine("ResetThirdPersonAngle");
                m_freeCamTimer = 1;
                target         = m_mainPlayer.transform.position - m_mainPlayer.transform.forward * 9.5f + m_mainPlayer.transform.up * 3;

                transform.position = DetectWalls(target);
                transform.rotation = Quaternion.LookRotation(m_mainPlayer.transform.forward + Vector3.up * 0.155f);
                //m_curPos.y = Mathf.LerpAngle(m_curPos.y, m_mainPlayer.transform.eulerAngles.y, 25 * Time.deltaTime);
            }
            if (m_mainPlayer.GetRewiredPlayer().GetButtonUp("Look Behind"))
            {
                StartCoroutine("ResetThirdPersonAngle");
                transform.position = m_mainPlayer.transform.position + m_mainPlayer.transform.forward * 5 + Vector3.up * 2;
                transform.rotation = Quaternion.LookRotation(-m_mainPlayer.transform.forward, m_mainPlayer.transform.up);
            }
        }