예제 #1
0
        public NavMeshTriangle(Vector3 vertex0, Vector3 vertex1, Vector3 vertex2, Vector2 uv0, Vector2 uv1, Vector2 uv2)
        {
            m_Root = new NavMeshTriangleNode();

            float maxX = Mathf.Max(vertex0.x, vertex1.x, vertex2.x);
            float maxY = Mathf.Max(vertex0.y, vertex1.y, vertex2.y);
            float maxZ = Mathf.Max(vertex0.z, vertex1.z, vertex2.z);

            float minX = Mathf.Min(vertex0.x, vertex1.x, vertex2.x);
            float minY = Mathf.Min(vertex0.y, vertex1.y, vertex2.y);
            float minZ = Mathf.Min(vertex0.z, vertex1.z, vertex2.z);

            Vector3 si = new Vector3(maxX - minX, maxY - minY, maxZ - minZ);

            if (si.x <= 0)
            {
                si.x = 0.1f;
            }
            if (si.y <= 0)
            {
                si.y = 0.1f;
            }
            if (si.z <= 0)
            {
                si.z = 0.1f;
            }
            Vector3 ct = new Vector3(minX, minY, minZ) + si / 2;

            this.m_Bounds = new Bounds(ct, si);

            this.vertex0 = vertex0;
            this.vertex1 = vertex1;
            this.vertex2 = vertex2;
            this.uv0     = uv0;
            this.uv1     = uv1;
            this.uv2     = uv2;
        }
예제 #2
0
 public NavMeshOcTreeNode(Bounds bounds)
 {
     this.m_Bounds   = bounds;
     this.m_ItemList = new List <NavMeshTriangle>();
 }