Need help adjusting camera rotation to normal of ground

i have a character that can walk up walls and i would like him to rotate properly whenever the surface he’s walking on changes. now, i can’t just get a rotation from z because then forward and right vector becomes random. any idea how i could fix this?

I had problems where when I change the pitch of my pawn I want to adjust the Yaw and Roll accordingly so when the pawn is on a slope, tipped upward, then the tilt still matches the slope as he turns right and left on it. Is this your scenario?