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
1
Question by why789 · May 11, 2012 at 04:48 PM · navmeshagentpathfindingfollowroadcost

NavMeshAgent following road (even if slightly longer path)

Hey all!

I have a basic scene with a plane as a ground and another thinner plane sitting on top of the ground that is acting as the road.

How would I make the NavMeshAgent follow the road rather than walk on the regular ground? I know if the Agent follows the road it will have a longer path, however, this is desired.

Things I've tried and their results:

  • Set ground on NavMeshLayer with cost of 1 and road on seperate NavMeshLayer with cast of 0.5 (no difference in path)

  • Same as above but changed road layer's cost to 5 (just a test to see what happens). Agent purposefully avoids road

  • Same as above but set Ground layer's cost a large number (10) and road's cost to a negative number (-10). No difference in path.

Could the problem be that the road object is sitting on top of the ground? In other words: 2 layers overlapping? If this is the problem how would we overcome this?

why789

Comment
Add comment · Show 1
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 why789 · May 13, 2012 at 01:58 AM 0
Share

Can anyone help me on this?

Thanks, why789

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by LukaKotar · May 11, 2012 at 04:55 PM

You should go into Window > Navigation, then select the plane under the road, and select Not Walkable in the Navigation panel. Mess around with the settings to get the result you want.

Comment
Add comment · Show 4 · Share
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 LukaKotar · May 11, 2012 at 04:57 PM 0
Share

And don't forget to bake your scene with the Bake button at the bottom ;)

avatar image why789 · May 11, 2012 at 04:58 PM 0
Share

Won't work.

The plane that's sitting under the road is the same plane that the player walks on (it's the ground).

So... If I set the ground as unwalkable I won't get too far.. hehe

avatar image LukaKotar · May 11, 2012 at 05:03 PM 0
Share

Then create a new layer for the ground, set the ground to the layer you just created, and on the Nav$$anonymous$$eshAgent, select this layer to not walkable only for the Nav$$anonymous$$eshAgents you want.

If I understand your question correctly...

avatar image why789 · May 11, 2012 at 05:39 PM 0
Share

@Luka$$anonymous$$otar No I don't think you understand...

I have the ground on the ground layer. The agents need to be able to walk on the ground layer (it's the ground...)

I have a plane sitting on top of the ground that represents the road.

How would I make the agent walk on the road if possible. The agent should still be able to walk on the ground, however, the road should have a higher priority, thus causing the agent to take a slightly longer path in order to follow the road to get to the destination.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

How to redirect a navmesh agent's path based on area costs? 0 Answers

AI pathfinding waypoints 1 Answer

Recentering an infinite world that has a NavMesh. 0 Answers

Use Fog of War to Restrict NavMesh Per-Agent 0 Answers

Pathfinding with NavmeshAgents in Unity 5? 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