c# - Unity Multiple navmesh agents . -


hello im working on rts game controll more 1 minion wen trie , add minion , command them both go point , @ each other http://imgur.com/a/uhwjg. code minions move :

using system.collections; using system.collections.generic; using unityengine; using unityengine.ai;  public class movetest : monobehaviour {      navmeshagent navagent;        // use initialization     void start () {         navagent = getcomponent<navmeshagent>();       }      // update called once per frame     void update () {          move();      }     void move()     {         raycasthit hit;         ray ray = camera.main.screenpointtoray(input.mouseposition);         if (input.getmousebuttondown(1))         {             if (physics.raycast(ray, out hit, 1000))             {                 navagent.setdestination(hit.point);              }          }     } } 

the agent go close can position. since you're telling both go same position, push in close can. might want increase stopping distance or add random.insideunitsphere hit.point more group


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -