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 /
avatar image
0
Question by Nanako · May 16, 2015 at 01:02 AM · navmeshpathing

Navmesh Pathing: Is there any way to loosen the path?

So i'm working on a physical pathing system that layers ontop of unity's. And i'm noticing some odd results, which ive traced to the fact that the paths are absurdly tight. They wrap around obstacles right to the edge as if expecting my character to be a robot on rails.

However it is not, it's a physical being which moves with forces, and like any such thing, it can't simply change direction on a dime, that's deliberate. This is causing some odd behaviour on tight corners (especially hairpin turns) where after skidding out to the side, my character doesn't proceed straight onwards down the path, but first doubles back to the edge of the hairpin to hit the path corner.

The best solution to this i feel, would be a better path. One that takes corners with a sufficient amount of leeway (adjustable presumably).

How can i loosen up the path and make it not hug corners so tightly?

Comment
Add comment · Show 5
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 Cherno · May 16, 2015 at 05:34 AM 0
Share

I can't help you directly, but I know that the Astar Pathfinding Proejct, available on the Asset Store for free, has such a feture, I think it's called Path $$anonymous$$odifiers. It can make a patch not go too close to walls and make nice smooth curves ins$$anonymous$$d of sharp turns. You could doanload it and take a look at the code. There's also an extended API on Aron Granberg's APP website.

avatar image khos85 · May 16, 2015 at 08:22 AM 0
Share

Could you use a waypoint system and loosen the movement on that?

avatar image karl_jones ♦♦ · May 16, 2015 at 10:12 AM 0
Share

You could try increasing the Agent Radius property.This property controls how close to walls the nav mesh exists.

avatar image Nanako · May 17, 2015 at 02:07 PM 0
Share

i was really hoping to not have to delve into external systems. I'll take a look at A*

Increasing the agent radius is a hack which has knock-on effects on other things, i'd rather not.

The solution i've eventually opted for is a rather obtuse coded solution, whereby if the angle to the next pathnode is small enough, and we're close enough to the current one, then i abandon the current and move to next.

avatar image wbknox · Dec 24, 2016 at 10:39 PM 0
Share

I attempted to find Nav$$anonymous$$eshObstacle radii that allowed tight fits but then plan at a larger radii, shrinking each radius down to its predesignated value when no path is found at the larger radii:

 float[] radiusParams;
 float[] radiusGrowthFactors = { 1.5f, 1.1f, 1.0f, 0.9f };

     private void CalcPath (Transform start, Transform end)
     {
     // get starting radius params
     radiusParams = new float[nav$$anonymous$$eshObstacles.Length];
     for (int j = 0; j < nav$$anonymous$$eshObstacles.Length; j++) { // set radius for each obstacle
         radiusParams [j] = nav$$anonymous$$eshObstacles [j].radius;
     }

         // iteratively try to find paths from larger obstacle expansions to smaller ones
         foreach (float radiusGrowthFactor in radiusGrowthFactors) {
             Debug.Log("Pathfinding with radius growth factor of " + radiusGrowthFactor);
             for (int i = 0; i < nav$$anonymous$$eshObstacles.Length; i++) { // set radius for each obstacle
                 nav$$anonymous$$eshObstacles [i].radius = radiusParams [i] * radiusGrowthFactor;
             }
 
             // try finding a path
             UnityEngine.AI.Nav$$anonymous$$esh.CalculatePath (start.position, end.position, UnityEngine.AI.Nav$$anonymous$$esh.AllAreas, path);
 
             // if path was found, break
             if (path.status == UnityEngine.AI.Nav$$anonymous$$eshPathStatus.PathComplete) {
                 Debug.Log("Path found with radius factor: " + radiusGrowthFactor);
                 break;
             }    
         }
         
         // reset obstacle radii
         for (int i = 0; i < nav$$anonymous$$eshObstacles.Length; i++) { // set radius for each obstacle
             nav$$anonymous$$eshObstacles [i].radius = radiusParams [i];
         }
         
     }

There are some variables initialized elsewhere. Feel free to ask for more info.

Unfortunately, in the actual pathfinding results, it seems that the different radii are never used in pathfinding. The results seem to only reflect the predeter$$anonymous$$ed radii.

$$anonymous$$y guess is that the radii changes take too long to get carved (or maybe carving isn't even triggered by a radius change). If someone can figure out how to force immediate carving, I think we'd have a solution, albeit one that may not be computational efficient enough for all use cases.

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

23 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How do I limit the path of a NavMeshAgent? 0 Answers

How can I tell when a navmeshagent has reached its destination? 10 Answers

Is there any way to find out if a specific position is on the navmesh? 1 Answer

Finding Closest Object Through Navmesh,Identifying Which Object Is Closest on NavMesh 0 Answers

Instantiated objects at beginning of runtime are messing with the pathing for my NavMesh. 0 Answers


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