my enemy does not look in the upward direction while shooting when the player is standing at the height i used these two methods but none of them making the enemy look towards the player when the player is at some height , im also adding the picture to make it clear
First method :
transform.LookAt (ThePlayer.transform.position);
Seond method:
Vector3 direction = ThePlayer.transform.position - transform.position;
direction.y = 0;
if (direction.x != 0 && direction.z != 0) {
transform.rotation = Quaternion.Slerp (transform.rotation, Quaternion.LookRotation
(direction), 1.5f * Time.deltaTime);
transform.eulerAngles = new Vector3 (0, transform.eulerAngles.y, 0);
Where are you putting the functions? Anything that you want overriding animation should be put in LateUpdate ().
It’s true those things has to be put in to the LateUpdate() and I think you can rotate it around the Y axis, but not around the others. So at ground level it should work, because you’re rotating it around the Y axis.