using System.Collections; using System.Collections.Generic; using UnityEngine; public class RotateAnimation : MonoBehaviour { public float rotationSpeed = 50f; private Vector3 rot; private void Start() { rot = transform.localEulerAngles; } void Update() { if (Input.GetKey(KeyCode.A)) { transform.Rotate(-Vector3.up * rotationSpeed * Time.deltaTime); } else if (Input.GetKey(KeyCode.D)) { transform.Rotate(Vector3.up * rotationSpeed * Time.deltaTime); } else { transform.localEulerAngles = rot; } } }