Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 yarekc · Jan 08, 2020 at 10:54 AM · navmeshnav mesh

How to handle many navmeshes in 1 scene ?

Hi, I used unity2019.3

I do use navMesh and navMeshAgent.

My goal is to change the navmesh on runtime: at begin, player can only walk in small red circle, then after some conditions, he can walk in a big rectangle area (small red circle is inside the big rectangle area)

Is it possible to have 2 navmeshes and then switch them by setActive(bool) ?

Any idea on how to achieve that ?

alt text

unity1.jpg (13.5 kB)
Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by Hellium · Jan 08, 2020 at 11:00 AM

You don't need several Navmeshes, a single one with several areas will work.


Then, set the mask on your agent according to your conditions.

 agent.areaMask = 1 << index_of_1st_layer |
     1 << index_of_2nd_layer |
     1 << index_of_3rd_layer;

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 yarekc · Jan 08, 2020 at 11:30 AM 0
Share

That looks promising.. but I just cannot find how to edit an area: when baked, it bakes always the WHOLE big rectangle.

  • How can I add a circle area in a navmesh ?

avatar image Hellium yarekc · Jan 08, 2020 at 11:51 AM 1
Share
  1. Create a new area in the Navigation window,

  2. Create a new Cylinder and place it so that its top surface is very close to the surface of your rectangle

  3. Set it to Navigation static

  4. In the Navigation window, select your new area in the Object tab (cylinder must be selected)

  5. Bake your navmesh (adjust the Voxel size to have a more precise shape around your cylinder)

  6. Disable the Cylinder

avatar image yarekc · Jan 08, 2020 at 04:47 PM 0
Share

Almost done: Just to understand well:

  • Walkable

  • Not walkkabe

  • Jump

  • bigRectangle

  • smallCircle

To choose smallCircle only :

 agent.area$$anonymous$$ask = 1<< 4 

To choose bigRectangle AND smallCircle

 agent.area$$anonymous$$ask = 1<< 3 | 1<<4

Is that correct ?

avatar image Hellium yarekc · Jan 08, 2020 at 04:50 PM 0
Share

It should, yes, give it a try!

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

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

Related Questions

How can I extract a mesh from the nav mesh? 1 Answer

Gaps in the Nav mesh 0 Answers

NavMesh issue with spawning players 3 Answers

New NavMeshSurface setup only uses layers and doesn't care about Navigation Static 1 Answer

Navmesh Agent "move back" when player comes to close? 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