Hi, I’m working with A* path finding and am trying to get some enemies to face the player:
void Update(){
transform.LookAt (target.position);
transform.Rotate (new Vector3(0, 270, 91),Space.Self);
}
However when the game runs, if the enemy rotates too far on the Z axis, the Y axis also rotates and due to this the collider on the enemy is removed until it further rotates on the Z, and it’s Y axis is back to original.
So my question is how can I have my enemy face the player via Z axis since it’s a top down shooter game, but also stop the Y axis from automatically rotating itself?