Updated ray-casting