I have a situation where i need a rigidbody character to remain perpendicular to the surface beneath the player, this is not always guaranteed to be in the Y direction for instance if the character was walking up a “vertical” wall. To move the rigidbody i am manually setting the velocity, this causes the rigidbody to topple over which is not what I want.
My question to you is, how can I make my character remain perpendicular to the surface beneath it using C# code? My character uses a ray cast down to detect whether he is grounded and I can use the normal from that to get the target rotation.