コード例 #1
0
    private void OnDrawGizmos()
    {
        if (!Application.isPlaying || !m_akaiController.IsGrounded())
        {
            return;
        }

        Gizmos.color = Color.red;
        Gizmos.DrawWireSphere(m_leftFootTransform.position, m_footRadius);
        Gizmos.DrawWireSphere(m_rightFootTransform.position, m_footRadius);

        Gizmos.color = Color.blue;
        Gizmos.DrawWireSphere(m_leftFootTarPos, m_footRadius);
        Gizmos.DrawWireSphere(m_rightFootTarPos, m_footRadius);
    }
コード例 #2
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (m_akaiController.IsGrounded())
        {
            Vector3 tarPos = m_akaiController.GroundAt().point + m_groundOffset;

            m_cameraBoom.transform.position = new Vector3(Mathf.Lerp(m_cameraBoom.transform.position.x, tarPos.x, 10.0f * Time.deltaTime),
                                                          Mathf.Lerp(m_cameraBoom.transform.position.y, tarPos.y, 5.0f * Time.deltaTime), Mathf.Lerp(m_cameraBoom.transform.position.z, tarPos.z, 10.0f * Time.deltaTime));

            //m_cameraBoom.transform.position = Vector3.Lerp(m_cameraBoom.transform.position, m_akaiController.GroundAt().point + m_groundOffset, 0.65f);
            //m_camera.transform.rotation = Quaternion.LookRotation((m_cameraBoom.transform.position - m_camera.transform.position).normalized);
            //m_cameraBoom.transform.position = m_akaiController.GroundAt().point + m_groundOffset;
        }
        else
        {
            m_cameraBoom.transform.position = transform.position;
            //m_camera.transform.rotation = Quaternion.LookRotation((transform.position - m_camera.transform.position).normalized);
        }

        if (m_move.magnitude <= 0.001f && !m_waitForInputDelay)
        {
            StartCoroutine(WaitForInputDelay());
        }
        else if (m_move.magnitude > 0.001f)
        {
            m_autoRotate = false;

            m_cameraBoom.transform.rotation *= Quaternion.Euler(0.0f, m_panSpeed * m_move.x * Time.deltaTime, 0.0f); // * Quaternion.Euler(m_tiltSpeed * m_move.y, 0.0f, 0.0f)
            m_cameraBoom.transform.rotation  = Quaternion.Euler(m_maxTiltAngle * m_move.y, m_cameraBoom.transform.rotation.eulerAngles.y, 0.0f);
        }

        if (m_autoRotate)
        {
            m_cameraBoom.transform.rotation = Quaternion.RotateTowards(m_cameraBoom.transform.rotation, transform.rotation, 1.25f);
        }
    }