Cloud prevCloud(Vector3d p) {
        int j = -1;
        float dy_min = RANGE * p.z;

        for (int i = clouds.size() - 1; i >= 0; i--) {
            Cloud cloud = clouds.elementAt(i);
            if (cloud.getY(p.z) <= p.y && cloud.age < 10) {
                float dy = p.y - cloud.getY(p.z);
                if (dy < dy_min) {
                    j = i;
                    dy_min = dy;
                }
            }
        }

        if (j != -1) return clouds.elementAt(j);

        //System.out.println("Prev cloud returning null");
        return null;
    }