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 Yanifska_ · Oct 25, 2013 at 10:34 AM · pathfindinglayersnavigationmask

NavMesh WalkableMask

Hi there,

I couldn't find too much info on the walkable mask and the manual is quite thin about this subject.

I set up doors with different NAvNesh layers, but I can't find a match between the layer index and the value of the walkableMask.

So my question is what is the value of the walkableMask parameter referencing to ? Is it a layer number ? but there are Built in layers and user layers.

For example in the user layer 1 I have setup door 1 and user layer 2 contains door2 How do I activate / deactivate them in runtime?

Please shed some light ! Thank you Yaniv

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 Yanifska_ · Oct 26, 2013 at 02:29 PM 0
Share

Nobody knows how to tweak navigation layers in game so a character will change it's trajectry or react to this change ? Basically what I want is that if my enemy is running for the player AND was about to cross the door THEN attack the door or whatever. Anyone ? Pleeeeease

2 Replies

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by Yanifska_ · Nov 25, 2013 at 07:48 AM

Jean from the Playmaker forum answered this in depth: http://hutonggames.com/playmakerforum/index.php?topic=5280.msg25225#msg25225

OK; let's do some binary maths!!!

http://en.wikipedia.org/wiki/Binary_number

Binary is a very powerful thing, you only have 0 and 1, and as you read a long binary number you need to think this way, lets' take an example

  • read the binary from right to left, each binary entry being indexes (n) with its integer equivalent being 2^n, n starting at 0, so the first slot on the right is indexed 0, not 1.

binary slots : x | x | x | x integer value: 8 | 4 | 2 | 1

so: 100 binary mean 4 as int (4+0+0) 101 means 5 (4+0+1)

Hopefully that make sense. So to translate this to the navmesh layers in Unity

nothing - 0
everything -1
layer 0 - 1 ( built in layer 0)
layer 1 - 2 ( built in layer 1)
layer 2 - 4 ( built in layer 2)
layer 3 - 8 ( user layer 0)
layer 4 - 16 ( user layer 1)
layer 5 - 32 ( user layer 2)
layer 6 - 64 ( user layer 3)
layer 7 - 128 ( user layer 4)

so, -- if you want to only have layer 3 ( user layer 0), the mask is 8, in binary, we would write 1000
-- if you want layer 3 AND layer 0, the mask is 8+1=9, in binary: 1001

to find out from the mask integer what layers are defined, it's bit a more complicated if you are not using binary math operators:
so we have 9:
the question to ask is:
-- what's the biggest multiple of two we can fit in 9, its 8, meaning we include layer 3,
-- we substract layer 3 we are now left with 1 (9-8)
-- what's the biggest multiple of two we can fit in 1, it's 1, meaning we include layer 0

Does that make sense? this way, with a single int, you can define a mask for any layers without risking confusion. 9 can only mean you include layer 3 and layer 0, reading the binary from right to left, 1001, we can find out visualy, that index 0 and 3 are set to 1, so layer 0 and layer 3 are included.

If you don't understand this, don't worry, get back to this and document yourself on the net and find examples to work with binary, it will start making sense if you actually use it and find real world examples.

Bye,

Jean

Comment
Add comment · Show 1 · 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 Deyama · Jun 04, 2016 at 02:06 PM 0
Share

Now that's an explanation! Thanks!

avatar image
0

Answer by hashashin · Nov 26, 2019 at 03:40 PM

I suppose Everything is not exactly 1...

Comment
Add comment · 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

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

17 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

Related Questions

Help with layers? 1 Answer

Help with understanding animation layers, masks & IK 0 Answers

Link two nodes with a edge 1 Answer

Pathfinding with AI On Grid and Off Grid with Rigidbody Forces 1 Answer

How to use Unity's pathfinding system without NavMeshAgent controlling my character? 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