Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by theAfrican · Aug 23, 2013 at 09:26 AM · navmeshnavmeshagentnavigation

Navmeshagent fails to calculate path. Useless!

Hi guys,

i have hit a major snag with the unity navmeshagents. i have a 2km by 2km terrain with mountains etc. i have baked a mesh, the agents are spawned at start(). only one agent is calculating the paths, the rest just stay there idle.

what are the limitations of navmeshagents? im using unity pro 4.0.0f. i use the same prefabs(navagents) on a smaller map and everything works... what is the solution or alternative to the navmeshagents. i tried other solutions i found like setting stoppingDistance=0; it still fails.

without pathfinding? my game is useless....

please advise. any other alternatives to navmesh...?

alt text alt text alt text

 function Start () {
  var ind:int=Random.Range(0,capturePoints.length);
  var avoidancePriority:int=Random.RandomRange(70,90);
  canShootRange=Random.RandomRange(20.0,50.0);
  h_renderer=h_renderer_obj.GetComponent(SkinnedMeshRenderer);
  g_renderer=g_renderer_obj.GetComponent(MeshRenderer);
  navagent=Instantiate(navagent_prefab,transform.position,transform.rotation);
  navagentcomponent=navagent.GetComponent(NavMeshAgent);
  navagentcomponent.avoidancePriority =  avoidancePriority;
  navagentcomponent.speed=Random.RandomRange(3.5,4.5);
  navagentcomponent.stoppingDistance=0;//Random.RandomRange(1.0,10.0);
  curDest = capturePoints[ind].transform.position;
  navagentcomponent.SetDestination(curDest);
  anim_controller.SetFloat("RunSpeed",0);
  anim_controller.SetLayerWeight(1,1);
  }
 
 private var followDist:float;
 private var MAX_MOVE_DISTANCE:float=50.0f;
 private var isShooting:boolean=false;
 function FixedUpdate () {
     if (navagentcomponent.active)
         {
         Debug.Log(gameObject.name+" :: "+navagentcomponent.hasPath);
         Debug.Log(gameObject.name+" :: remainingDistnce: "+navagentcomponent.remainingDistance);
         var moveDistance:float = MAX_MOVE_DISTANCE * Time.deltaTime;
         var source:Vector3 = transform.position;
         var target:Vector3 = navagent.transform.position;    
         var seekVelocity = Seek(source, target);
             seekVelocity = ClampMagnitude(seekVelocity,moveDistance);
             followDist=(navagent.transform.position-transform.position).magnitude;
             followDist=Mathf.Clamp(followDist,0,1);
             anim_controller.SetFloat("RunSpeed",followDist);        
             rigidbody.AddForce( seekVelocity, ForceMode.VelocityChange );
             //navagent.transform.LookAt(curDest);
             if (!isShooting) transform.LookAt(navagent.transform);
     }
 }

alt text

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Linus · Aug 23, 2013 at 11:27 AM 0
Share

Please post the code you have so far. A picture of relevant data from the scene might also increase your chance of getting a good answer.

avatar image theAfrican · Aug 23, 2013 at 01:36 PM 0
Share

@Linus i have updated the question

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

16 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

NavMesh issue with spawning players 3 Answers

Navigation Agent "Clipping" (Going inside) Navmesh Deadzone?... 1 Answer

Constantly generating Navmesh destination for endless runner game 0 Answers

Interactable object as navmesh obstacle.,How can I make an object interactable while it's a navmesh object? 0 Answers

Enemies using navmesh are bumping each other through solid objects 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges