Ejemplo n.º 1
0
    private void FindIntersectionPoint(Vector3 lineStart, Vector3 lineEnd)
    {
        PolygonGenerator pg = lineSource.GetComponentInChildren <PolygonGenerator>();

        Vector3[] verts = pg.GenerateWorldVertices();
        for (int i = 0; i < verts.Length; i++)
        {
            Vector3 polygonSideStart = verts[i];
            Vector3 polygonSideEnd;
            polygonSideEnd = GetPolygonSideEnd(verts, i);


            LineIntersectionManager.IntersectionCheck ic = LineIntersectionManager.DoLinesIntersect(lineStart, lineEnd, polygonSideStart, polygonSideEnd);
            if (ic.didIntersect)
            {
                intersectionMarker.SetActive(true);
                intersectionMarker.transform.position = ic.intersectionPoint;
            }
        }//end for
    }