PlayerLookAt.cs 472 B

12345678910111213141516171819202122
  1. using UnityEngine;
  2. namespace Cinemachine.Examples
  3. {
  4. public class PlayerLookAt : MonoBehaviour
  5. {
  6. public float speed = 5f;
  7. void Update()
  8. {
  9. #if ENABLE_LEGACY_INPUT_MANAGER
  10. float horizontal = Input.GetAxis("Mouse X") * speed;
  11. float vertical = Input.GetAxis("Mouse Y") * speed;
  12. transform.Rotate(0f, horizontal, 0f, Space.World);
  13. transform.Rotate(-vertical, 0f, 0f, Space.Self);
  14. #else
  15. InputSystemHelper.EnableBackendsWarningMessage();
  16. #endif
  17. }
  18. }
  19. }