Quantcast
Channel: Questions in topic: "moveto"
Viewing all articles
Browse latest Browse all 116

Why does the NPC keeps sinking when moving?

$
0
0
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

Viewing all articles
Browse latest Browse all 116

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>