How to Rotate the Player through code

Yello guys,

I use Gravity Controller to allow players to walk on walls, and have added a function that gives the player more control over this system.

It uses RayCasting and returns a Vector3 and the players Gravity is changed to that.

It works great!

But the change does not happen quick enough, resulting in this:
https://gyazo.com/a0b6e23bba59648ce385a9d4e1c2cc9e

Now I know that clip doesn’t really explain my problem, so here an explanation:

Basically the function returns the Vector3 and the players gravity is changed so they begin to walk on the object they returned.

The issue happens because the player cannot rotate fast enough.

You see the Gravity is instantly changed but the player still has to rotate in order for them to begin walking on the object. Since the Gravity Changes but the rotation cannot keep up, the player sometimes just flies to a random spot as seen in the clip.

Now I am quiet new to scripting but I am assuming that this is possible.

I believe that best fix for this issue would be to rotate the player through code so their body is already in the right position immediately following the gravity change.

This is where I am lost however, since I have never done this before and am unsure of how I would even begin to it. I have tried looking for prior examples of this being down, but have not been able to find anything that really helps.