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);
it calls the moveto() function that actually moves the NPC
transform.Translate(Vector3.forward * moveSpeed *Time.deltaTime);
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