I try to make cannon aim at enemy. The code work well for fixed y axis, but when i replace "direction.y=0" by "direction.x=0" , something go wrong. When the enemy is far away, it works well. However when the enemy move pass cannon in z direction, the cannon suddenly rotates in x axis and become upside down. Code (CSharp): GameObject enemy = GameObject.Find("Enemy"); Vector3 direction = enemy.transform.position - transform.position; direction.y = 0; Quaternion toRotation = Quaternion.LookRotation(direction); transform.rotation = Quaternion.RotateTowards(transform.rotation, toRotation, 10 * Time.deltaTime);