Navmesh Agent disables collider while moving to destination

Hi. I have an enemy and a player in my scene. The enemy has a navmesh agent component and a script to command the navmesh agent to chase the player. It stops the enemy at a distance where it can hit the player.
__
But, when the player tries to move through the enemy, the enemy’s collider doesn’t work and the player can go through the enemy.
__
I tested the same scene again with the script that commands the navmesh agent to chase the player disabled. And, I realized that the player collides perfectly fine with the enemy when the navmesh agent is not moving.

Any help plz?

202261-image-2022-11-26-103352636.png

So, I was using the transform.LookAt() method for the enemy to look at the player. And I realized that when I turned the NavMesh Agent off, the actual rotation of the enemy was skew. The NavMesh Agent was overriding the rotation.

I used another method for the enemy to look at the player.

        Vector3 dir = (playerTransform.position - transform.position).normalized;

        float angle = Mathf.Atan2(dir.x, dir.z) * Mathf.Rad2Deg;
        
        transform.rotation = Quaternion.AngleAxis(angle, Vector3.up);