Cube and switch AI improvements

reduced collision check code to a single if statement and oneside
collision function