Just modified the code in the event:
//if (x>-0.18-xbuilding+1.0e-5) return theta; // check y > yground do nothing
//else return 1.0e-5; // y>yground return y when y?yground to the limit of the ground to tolerance
return theta;

And it should work fine. I guest that you have other model in mind (need to be implemented) to take care of the collision.