Fixed (hopefully) all raycasting bugs and added collision detection