Unit should always move to one goal, which moves.
using system.collections;
Using System.Collections.Genic;
using unityengine;
using unityengine.ai;
Public Class Banditmechanic: Monobehaviour {
Navmeshagent Agent;
Public Transform Target;
void start () {
agent = getComponent & lt; navmeshagent & gt; ();
Agent.Autorepath = true;
Agent.SetDestination (target.position);
}
void fixedupdate () {
// agent.destination = target.position;
}
}
I wrote such a code. But the unit moves Dergano (jerks), it seems to me because I constantly change the path (if you set a static goal, it moves normally). How to properly set the goal that is constantly moving?
Answer 1
void fixedupdate ()
{
_navmeshagent.setdestination (_player.position);
}
everything works fine. Nothing twitched. Probably case in another.