How to make character stop when facing the wall

I’m actually using the TPC as 1st person. I don’t know if you tested it or not but I think the trace in 4 directions might not work because of the gaps between the lines. The way i’m trying right now is working walking forward, so I only need to make it happen walking backwards and sideways, but don’t know how.