How do i line trace along a surface normal?


I am doing an auto cover system for my fps character and i detect cover by using these box traces. But to detect the end of the wall it would work a lot better if i knew how to always start the line trace paralel to the wall, from the outside to the inside(front of player). Can someone please help me?

If you don’t want to worry about orientations, you should use a line trace instead of a box trace.

If you want your box to run flat against the wall, then you need to set the trace orientation based on that wall’s surface normal (Hit normal).

  • [Break Hit Result][1]

I wrote out a solution that should work for you, and explained it as I went on stream.

  • [Here’s the paste of code][2]
  • [Here’s the timestamp of me explaining it on stream][3]

Wow thank you so much! this just solved my problem! and very well explained!

Hey! glad this helped!
You should upvote, and mark as answer :slight_smile: