Patrolling AI can't see behind him even though his collider extends.
New to coding at all and I have a working patrolling enemy, but he only triggers twice for some reason and he can only see in front of him. I have a horizontal capsule collider on him so if you enter he should see in front and in back once the player enters the collider. (It is already set to trigger) My code for seeing and catching the player is as follows:
private void playerFound ()
{
Vector3 lookAtPos = Player.position;
lookAtPos.y = transform.position.y;
transform.LookAt(lookAtPos);
if(Vector3.Distance(transform.position,Player.position) > MinDist)
{
transform.position += transform.forward * MoveSpeed * Time.deltaTime;
}
}
Like I said, it works but only twice. Why?
Your answer
![](https://koobas.hobune.stream/wayback/20220612111450im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Editing an AI patrolling script 1 Answer
How do I get my guard(s) to stop at NavPoint(s) and go into IdleState in C# 0 Answers
Monsters are walking around without my permission, why? 0 Answers
How do I get my AI to chase the player?,How do I go from patrolling to chasing the player? 3 Answers
Sprite AI rapidly flipping to try and face the player. This is driving me insane. 0 Answers