RotationController.cs 365 B

12345678910111213141516
  1. using UnityEngine;
  2. using System.Collections;
  3. public class RotationController : MonoBehaviour {
  4. public float speed = 1.0f;
  5. // Update is called once per frame
  6. void Update () {
  7. if (Input.GetAxis("Horizontal") != 0) {
  8. Vector3 angles = transform.eulerAngles;
  9. angles.y += Input.GetAxis("Horizontal") * speed;
  10. transform.eulerAngles = angles;
  11. }
  12. }
  13. }