Exemple #1
0
    // Draw a corner if the 3 spawnedWalls intersect at a single point
    private void DrawOneCorner(GameObject s0, GameObject s1, GameObject s2)
    {
        Vector3 point;
        bool    success = Math3DUtils.planesIntersectAtSinglePoint(s0, s1, s2, out point);

        if (success)
        {
            GameObject go = Math3DUtils.CreateSphere(point, Color.yellow, 0.1f);
            ui3dGOs.Add(go);
            go.name = "Corner";

            GameObject line0 = DrawCornerLine(point, s0, s1, s2);
            GameObject line1 = DrawCornerLine(point, s1, s2, s0);
            GameObject line2 = DrawCornerLine(point, s2, s0, s1);

            if (line0)
            {
                line0.transform.parent = go.transform;
            }
            if (line1)
            {
                line1.transform.parent = go.transform;
            }
            if (line2)
            {
                line2.transform.parent = go.transform;
            }

            AddPointToWall(s0, point);
            AddPointToWall(s1, point);
            AddPointToWall(s2, point);
        }
    }