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 luckruns0ut · Apr 10, 2013 at 10:23 AM · c#navmeshpathfindingnavigation

Making my own navmesh

Hi, I was in the middle of making an a* algorithm for a project the other day and ran into the problem that I couldn't find a way to place nodes or check if they were walkable.

I've already got the algorithm done so it is able to path find, however I need to somehow create a navmesh made up of nodes, and it has to work for all GameObjects, not just terrain. How should I go about doing this?

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 whydoidoit · Apr 10, 2013 at 10:46 AM 0
Share

Do you really mean a Nav$$anonymous$$esh, which is generated by dividing the empty space using polygons? Or do you want your way points to be navigable points on a network of points?

avatar image luckruns0ut · Apr 10, 2013 at 11:04 AM 0
Share

I'm not entirely sure what a Navmesh actually is, my understanding of it was just a collection of points generated from a mesh. I'm looking to create paths without manually setting up node graphs.

1 Reply

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

Answer by whydoidoit · Apr 10, 2013 at 11:28 AM

So to make a network of points the steps I take are these:

For each point:

  • Determine ground level by firing a ray downwards from the point until it hits an object in a layer I have determined is walkable

  • CheckCapsule the ground aligned point to make sure it is walkable given overhead obstructions or blockage by some scenery object.

  • Raycast (or sphere cast) all other points within a predefined radius at a known height above the floor (to avoid floor angle changes blocking the cast), if the raycast hits nothing then add the point to a list of connected points.

  • Destroy any points that have no connections

Note that I also allow for predefined connections if necessary - each of my nav points has a bool to say whether it should raycast for connections. This allows you to configure special areas where it's just easier to set them up.

The other way is to make a grid based nav mesh (which truly isn't actually a nav mesh either unless you combine the cells). I describe this technique in this Unity Gems article

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 luckruns0ut · Apr 10, 2013 at 11:37 AM 0
Share

This is a good approach. Will the raycasting be fast enough to do at runtime or will that require a separate thread?

avatar image whydoidoit · Apr 10, 2013 at 11:45 AM 0
Share

Well I do it at level startup and then I do different things for dynamic obstacle avoidance - but presu$$anonymous$$g that you have the initial setup then yes, it should be fine.

avatar image luckruns0ut · Apr 10, 2013 at 11:47 AM 0
Share

Thanks for the help.

avatar image Mandark · Mar 24, 2021 at 12:21 PM 0
Share

Link to archived Unity Gems Article site: https://web.archive.org/web/20140223101216/http://unitygems.com/astar-1-journeys-start-single-step/

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

13 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

Related Questions

Make a flying enemy ? 0 Answers

Navmesh on all sides of an object? 0 Answers

SetDestination's and CalculatePath's Path State Return Works Too Late 1 Answer

How to implement the flying AI path finding? 3 Answers

How to queue NavMeshAgents on entering a tile in Unity (based on path distance to tile)? 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