Look where your're going!

Ok, i give up.

I have a 2.5D Platformer, and all i need to know is how i make the character face the direction he is moving.

I know it should be a very simple thing, but i just don’t seem to be able to get it right :frowning:

Im using a very simple moving script:

        if(Input.GetButton("right"))
	{
			transform.position += transform.right *moveSpeed* Time.deltaTime;
	}
		if(Input.GetButton("left"))
	{
			transform.position += -transform.right *moveSpeed* Time.deltaTime; 
	}
		if(Input.GetButton("jump"))
	{
			transform.position += transform.up *height* Time.deltaTime; 
	}
	}

If the camera is static, aside from scrolling, and the player is only able to move in those specific directions- That is, just forward, backward, and up, with no inbetweens- You can just put in a bit in each that’ll tell the player object which way to rotate.

So, for example:

if(Input.GetButton("right"))
    {
         transform.position += transform.right *moveSpeed* Time.deltaTime;
         transform.rotation = 90;
    }
if(Input.GetButton("left"))
   {
         transform.position += -transform.right *moveSpeed* Time.deltaTime; 
         transform.rotation = 270;
   }