How can I rotate the player to fixed rotation?

Hi guys

I recently started with untiy and I’m trying to recreate PacMan.
Right now I’m working on the PlayerMovement script and have a problem with the rotation.

I want the character to always look at the direction it moving. In PacMan there are only 4 directions (Up, Left, Down, Right)

I tried a lot of stuff already. I have to add to this that, even if I have some basic programming knowledge, I can’t wrap my head around the whole rotation/quaternion thing.

I wanted to use Quaternion.slerp but with that I didn’t know how I can set the target direction

Please help me or if possible, lead me to a pleace, where the whole rotation thing is explained in a way that I can understand it.

Thanks a lot.

This is what I have so far:

var player : Transform;
var moveSpeed = 10;
var rotateSpeed = 10;

//This was my idea to have fixed points to rotate to...
var directionLeft = Vector3(1,0,0); 
var directionRight = Vector3(-1,0,0);
var directionUp = Vector3(0,0,-1);
var directionDown = Vector3(0,0,1);

function Update(){
  var controller : CharacterController = GetComponent(CharacterController);

  //this is just for the "up" direction
  if (Input.GetButton("Move Up"))
	controller.SimpleMove(directionUp * moveSpeed);
        //here would be the roationscript

Have you tried the SetLookRotation or LookRotation functions? Also considering that you are only dealing with 4 possible desired rotations you may just want to save them ahead of time.

Quaternion rot1 = Quaternion.Euler(0.0f, 0.0f, 0.0f);
Quaternion rot2 = Quaternion.Euler(0.0f, 90.0f, 0.0f);
//and so on..