public CollisionMap1(Vector3[] dragLines, Drag3D[] cubes)
    {
        perNodeCollision = new List <CollisionBucket> [dragLines.Length];

        mDraglines = dragLines;

        for (int i = 0; i < dragLines.Length - 1; i++)
        {
            perNodeCollision[i] = new List <CollisionBucket>();

            int n_buckets = (int)((dragLines[i + 1] - dragLines[i]).magnitude / resolution) + 1;
            for (int p = 0; p < n_buckets; p++)
            {
                CollisionBucket cb = new CollisionBucket();

                cb.left  = new CollisionInfo(ray_length, -1);
                cb.right = new CollisionInfo(ray_length, -1);
                perNodeCollision[i].Add(cb);
            }
        }

        collisionNote = new Dictionary <int, List <int> >();

        for (int i = 0; i < cubes.Length; i++)
        {
            collisionNote.Add(cubes[i].gameObject.GetInstanceID(), new List <int>());
        }
    }
    public void AddCollisionInfo(int dragline, int bucket, float min_height, float max_height, int ID, bool contained)
    {
        CollisionBucket cb = perNodeCollision[dragline][bucket];

        if (cb.left == null)
        {
            cb.left = new CollisionInfo(min_height, ID, contained);
        }
        else if (min_height == ray_length)
        {
            // No collision since ray didn't hit
        }
        else
        {
            if (min_height <= cb.left.height)
            {
                // Collision happened
                if (cb.left.was_contained)
                {
                    collisionNote[cb.left.ID].Add(ID);
                    collisionNote[ID].Add(cb.left.ID);
                }
                cb.left = new CollisionInfo(min_height, ID, contained);
            }
            // min_height > cb.left.heigh && contained
            // aka: I should go here but I am too big
            else if (contained)
            {
                collisionNote[cb.left.ID].Add(ID);
                collisionNote[ID].Add(cb.left.ID);
            }
        }


        if (cb.right == null)
        {
            cb.right = new CollisionInfo(max_height, ID, contained);
        }
        else if (max_height == ray_length)
        {
            // No collision since ray didn't hit
        }
        else
        {
            if (max_height <= cb.right.height)
            {
                // Collision happened
                if (cb.right.was_contained)
                {
                    collisionNote[cb.right.ID].Add(ID);
                    collisionNote[ID].Add(cb.right.ID);
                }
                cb.right = new CollisionInfo(max_height, ID, contained);
            }
            // max_height > cb.right.heigh && contained
            // aka: I should go here but I am too big
            else if (contained)
            {
                collisionNote[cb.right.ID].Add(ID);
                collisionNote[ID].Add(cb.right.ID);
            }
        }
    }