Raycasting bugfix

Raycasting now works as intended.