Eonirr

Untitled

Oct 18th, 2025
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. protected void LookAtPlayer()
  2. {
  3. if (playerController)
  4. {
  5. Vector3 direction = (playerController.transform.position - transform.position).normalized;
  6. direction.y = 0f;
  7.  
  8. Quaternion targetRotation = Quaternion.LookRotation(direction);
  9. transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, 10f * Time.deltaTime);
  10. }
  11. }
Advertisement
Add Comment
Please, Sign In to add comment