void OnDrawGizmos()
    {
        Camera camera = gameObject.GetComponent <Camera>();

        if (camera)
        {
            GizmosEx.DrawViewFrustum(camera, Color.yellow);
        }
    }
Exemple #2
0
    void OnDrawGizmosSelected()
    {
        Matrix4x4 proj = default(Matrix4x4);

        if (m_Orthographic)
        {
            proj = Matrix4x4.Ortho(-m_AspectRatio * m_OrthographicSize, m_AspectRatio * m_OrthographicSize,
                                   -m_OrthographicSize, m_OrthographicSize, m_NearClipPlane, m_FarClipPlane);
        }
        else
        {
            proj = Matrix4x4.Perspective(m_FieldOfView, m_AspectRatio, m_NearClipPlane, m_FarClipPlane);
        }
        GizmosEx.DrawViewFrustum(proj, transform.localToWorldMatrix, new Color(0.65f, 0.65f, 0.65f, 1));
    }
Exemple #3
0
    void OnDrawGizmosSelected()
    {
        Matrix4x4 proj = default(Matrix4x4);

        if (m_Orthographic)
        {
            proj = Matrix4x4.Ortho(-m_AspectRatio * m_OrthographicSize, m_AspectRatio * m_OrthographicSize,
                                   -m_OrthographicSize, m_OrthographicSize, m_NearClipPlane, m_FarClipPlane);
        }
        else
        {
            proj = Matrix4x4.Perspective(m_FieldOfView, m_AspectRatio, m_NearClipPlane, m_FarClipPlane);
        }
        GizmosEx.DrawViewFrustum(proj, transform.localToWorldMatrix, new Color(0.65f, 0.65f, 0.65f, 1));
        if (m_Mesh != null)
        {
            Matrix4x4 posOffMatrix = Matrix4x4.TRS(transform.position, Quaternion.identity, transform.localScale);
            m_Mesh.OnDrawGizmosSelected(transform.localToWorldMatrix * posOffMatrix);
        }
    }