Corrected some mistakes in collision cases
Added ray object for ray casting