Finished raycasting. Untested.