NPC Keeps walking through Terrain

Well I am doing a simple game which consists of multiple NPCs , each npc has a Character controller attached on it with NO rigidbody.
the NPC has an AI script attached to it so when it sees my main character it starts following it then hitting it.
When the NPC starts moving he slowly keeps sinking through the terrain.

In the AI script , when am in the range of the enemy it calls this function :

function lookAt (trg : Vector3)
{
var rotation = Quaternion.LookRotation(trg - transform.position);
transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * damping);
moveto();
}

it calls the moveto() function that actually moves the NPC

function moveto()
{
transform.Translate(Vector3.forward * moveSpeed *Time.deltaTime);
animation.Play(“DemonRun”);
}

I am suspecting that the issue is with the moveto function , thanks in advance … am sorry if I missed anything , its my first post here :slight_smile:

If your NPCs have character controllers attached then you should be using the CharacterController.Move or CharacterController.SimpleMove functions to update the positions of your characters. These function perform the collision detection and response.