speed up and perfect raycast