first person rotation unity code example
Example: c# unity rotate first person controller script
public class myFPSBehavior : MonoBehaviour {
public float rotationSpeed = 10.0F;
void FixedUpdate()
{
if (Input.GetKey("escape"))
Application.Quit();
float rotation = Input.GetAxis("Rotate") * rotationSpeed;
rotation *= Time.deltaTime;
transform.Rotate(0, rotation, 0);
}
}