Fix to RayCast hack from getmoai.com forum.