Help: Get surface angle of game object with raycasthit? (C#)

I am making a pathfinding AI script and need to know how I could hit an object with a raycast and with that be able to know which angle the Ai player would have to walk along that wall in a parallel angle to the wall.

Sorry if this is hard to understand, and thanks in advance!

Nevermind, I found a way. For anybody wandering, this is how I did it.
this.transform.rotation = Quaternion.Euler(0, Hit.transform.eulerAngles.y+90), 0);