Hey, Im working on a side scroller and the player rotates left or right depending on the position of the mouse in relation to the center of the screen. Heres the code;
var MousePosition = Input.mousePosition;
MousePosition.x -= Screen.width / 2;
MousePosition.y -= Screen.height / 2;
if(MousePosition.x < 0)
{
transform.rotation = Quaternion.Euler(0,180,0);
}
else if(MousePosition.x > 0)
{
transform.rotation = Quaternion.Euler(0,0,0);
}
Now what Id like to do is have the players position on screen (the camera has a Lerp smooth follow thing on it) offset were the rotation takes place, kind of like screen.width is local, if that makes sense.