line of sight algorithm working