LookAt doesnt work

So I want the object “TestEnemyCharacter” looking at my character as soon as a collision is triggered. However, whatever method I use to do it, the object always looks at a wrong direction that seems to be completely random. The object is also rotated, but I tried it without and it didnt change anything. I also think the properties of the collider that triggers the method doesnt play any role since im not turning the collider, but the object.

    void OnTriggerEnter(Collider other)

        if (other.gameObject.tag == "Player")
            var target = GameObject.Find("Character");
            GameObject.Find("TestEnemyCharacter").transform.LookAt(new Vector3(-target.transform.position.x, transform.position.y, -target.transform.position.z));


thank you for the help!

LookAt will turn the GameObject so that its Z axis points towards the given transform or worldspace vector. So in your case, you only need to feed it the player’s transform:


This would work as you wrote if you removed the negatives from the vector.x and .z (which would be equivalent to target.transform.position).