Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void LookAtPlayer()
- {
- if (playerController)
- {
- Vector3 direction = (playerController.transform.position - transform.position).normalized;
- direction.y = 0f;
- Quaternion targetRotation = Quaternion.LookRotation(direction);
- transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, 10f * Time.deltaTime);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment