# LookAt() doesn't really do what I want

Hey guys

I’m making an action RPG game and of course, I have enemies. When I walk in their sight, I call the lookAt function and make it look to the target inside my player. That part works, but if I turn, the enemy also turns and then basically moonwalks towards me and only faces me if I look at him. What should I do?
(It’s probably something really stupid I’m overlooking ;/)

this is the code I have for it:

````
void OnTriggerStay(Collider other)
{
{
transform.LookAt(transform.position + player.transform.rotation * Vector3.forward, player.transform.rotation * Vector3.up);
Vector3 direction = other.transform.position - transform.position;
if (Physics.Raycast(transform.position, direction.normalized, out hit))
{
if (hit.collider.gameObject == player)
{
if (hit.distance &lt= 9 && hit.distance &gt 2.5f)
{
ai.Chase();
attack = false;
}
else if (hit.distance &lt= 2.5f)
{
ai.Attack();
attack = true;
}
else
{
ai.Idle();
attack = false;
}
}
}
}
}
`
```

Hope you guys can help me

You have a pretty complicated formula where you factor in the player’s rotation when setting the look direction of the enemy.

``````transform.LookAt(transform.position + player.transform.rotation * Vector3.forward, player.transform.rotation * Vector3.up);
``````

All that’s required should be to set it to look at the player position (how the player is rotated shouldn’t be factored into the equation of where the enemy should look, unless there’s some requirement you didn’t tell about)

``````transform.LookAt(player.transform.position);
``````