Facing a Wall Surface (Perpendicular)

Currently I have a character climbing a wall, which is great but if the player happens to be facing the wall at an angle, then my character will clip with the wall and "climb" it in a way that is not realistic.

To fix this, I'd like to take the normal from my RaycastHit result and use that to find the surface, then make my character rotate to face the surface square on (i.e. Zaxis is perpendicular to the surface, or alternately the Xaxis is parallel).

What is the best means of doing this?

The current information I have available include the collider of the character and the RaycastHit result from a Physics.Raycast operation.

You can use `Quaternion.LookRotation()` for this... something like

transform.rotation = Quaternion.LookRotation(-raycastHit.normal);

That'll take care of non-vertical walls with the character right-side-up (that is, their local Z axis will point towards the surface, and their local Y axis will point as "up" as possible). If you want the character to be not right-side-up, a slightly different approach will work... let me know.