private void OnDrawGizmos()
        {
            float distance = UGeometry.RayPlaneDistance(m_Plane, m_Ray);

            Gizmos.matrix = transform.localToWorldMatrix;
            Vector3 planeSize   = new Vector3(1, 0, 1);
            float   rayDistance = 1f;
            bool    intersect   = distance >= 0;

            if (intersect)
            {
                Vector3 hitPoint = m_Ray.GetPoint(distance);
                Gizmos.color = Color.red;
                Gizmos.DrawSphere(hitPoint, .05f);
                rayDistance = distance;
                planeSize   = new Vector3(Mathf.Max(1, Mathf.Abs(hitPoint.x) * 2), 0, Mathf.Max(1, Mathf.Abs(hitPoint.z) * 2));
            }

            Gizmos.color = intersect? Color.white:Color.grey;
            Gizmos_Extend.DrawLine(m_Ray.ToLine(rayDistance));
            Gizmos.matrix = transform.localToWorldMatrix * Matrix4x4.TRS(m_Plane.Position, Quaternion.LookRotation(Vector3.forward, m_Plane.normal), Vector3.one);
            Gizmos.color  = intersect ? Color.green : Color.grey;
            Gizmos_Extend.DrawArrow(Vector3.zero, Quaternion.LookRotation(Vector3.up), .3f, .1f);
            Gizmos.DrawWireCube(Vector3.zero, planeSize);
        }
Exemplo n.º 2
0
        private void OnDrawGizmos()
        {
            Gizmos.color  = Color.green;
            Gizmos.matrix = transform.localToWorldMatrix;
            Gizmos.DrawLine(Triangle[0], Triangle[1]);
            Gizmos.DrawLine(Triangle[1], Triangle[2]);
            Gizmos.DrawLine(Triangle[2], Triangle[0]);
            if (m_PlaneDirectionCheck)
            {
                Gizmos_Extend.DrawArrow(Triangle.GetUVPoint(Vector2.one * .25f), Quaternion.LookRotation(Triangle.normal), .5f, .1f);
            }

            float distance = 2f;

            if (UGeometry.RayDirectedTriangleIntersect(Triangle, m_Ray, m_RayDirectionCheck, m_PlaneDirectionCheck, out float rayDistance))
            {
                distance     = rayDistance;
                Gizmos.color = Color.red;
                Gizmos.DrawSphere(m_Ray.GetPoint(distance), .05f);
            }
            Gizmos.color = Color.white;
            if (m_RayDirectionCheck)
            {
                Gizmos_Extend.DrawArrow(m_Ray.origin, Quaternion.LookRotation(m_Ray.direction), .5f, .1f);
            }
            Gizmos.DrawLine(m_Ray.origin, m_Ray.GetPoint(distance));
        }
 private void OnDrawGizmos()
 {
     if (!gameObject.activeInHierarchy || !enabled)
     {
         return;
     }
     Gizmos.color  = IndexToColor(m_Index);
     Gizmos.matrix = transform.localToWorldMatrix;
     Gizmos_Extend.DrawArrow(Vector3.up * m_PlaneOffset, Quaternion.LookRotation(Vector3.up), .5f, .1f);
     Gizmos.DrawWireCube(Vector3.up * m_PlaneOffset, m_MeshFilter.sharedMesh.bounds.size.SetY(0));
 }
    private void OnDrawGizmos()
    {
        if (!m_BindRoot || !m_Gizmos)
        {
            return;
        }

        if (!Application.isPlaying)
        {
            ForceSetCamera();
        }



        Gizmos.color = Color.blue;
        Gizmos.DrawSphere(Vector3.zero, .2f);
        Gizmos_Extend.DrawArrow(m_Camera.transform.position, m_Camera.transform.rotation, .8f, .2f);

        Gizmos.color = Color.green;
        Gizmos_Extend.DrawCylinder(m_BindRoot.position, Quaternion.LookRotation(Vector3.up), .2f, 2f);

        Gizmos.matrix = GetBindRootMatrix();
        Gizmos.DrawWireSphere(m_BindPosOffset, .5f);
    }