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 kCortez · Oct 10, 2014 at 03:37 AM · aipathfindingdynamic

Navigation dynamic level generation

I've been working on a project where my game creates a small field of squares on a plane (the squares are technically cubes), each of size 2, 0.1, 2 (xyz) and creates something like a chess game, where each of these squares can have something on it (or not).

The idea is to navigate from a side to another in the field, avoiding anything that can be placed there (it is placed by the player so it must be dynamic).

The real problem is: The normal navmesh resource will just fail to work well with the said dynamic field, so even tagging dynamically created objects as obstacles would not be a solution for my problem, since the field itself is not a obstacle and anything else (other than the field itself) is not supposed to be used by the AI.

I read about a lot of different free solutions for dynamic navigation but it looks like none of them actually gives me what i need, wich is in fact somehow simple: Tag free spots as navigation points and let the ai do its job (i do keep track of what is free and what is being used, so i can actually update the objects state to match the reality of the game, as possible navigation point or not).

Since im somehow new to this thing, i also read a lot of questions like this one but it looks different since im not using a pre-made game terrain and i can be mistaken about tools not being able to do this (the ones i read about at least), if so, please point me out a tool and i can run some tests on it. Also, any further description needed please just ask and i will be happy to provide more information.

Thanks in advance

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
0

Answer by Cherno · Oct 10, 2014 at 07:34 AM

Here is how I did it for my Minecraft-like dungeoncrawler, using Granberg's free A* Pathfinding Project:

After creating the mesh for the level itself (floors, walls and such), I re-use the floor mesh generation code to create a mesh for the NavMesh. Each object that can be placed and needs to be impassable hasa Graph Update Object component added to it, and applied upon instantiating. Works flawlessly so far.

Comment
Add comment · Show 2 · 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 kCortez · Oct 10, 2014 at 09:13 PM 0
Share

I actually did some further reading on the A* project and it looks like it can be done, do you have any code samples or documentation for that specific task?

avatar image Cherno · Oct 10, 2014 at 09:35 PM 0
Share

It all depends on how you build your world. In your case, it sounds like you can just have a GridGraph with one node per tile, and when an obstacle is created, you just call

 GetComponent<GraphUpdateScene>().Apply();

on the object (it needs a GraphUpdateScene component, of course). The nodes that are overlapped by the object's GUO boundaries are then flagged as non-walkable.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

AI on dynamic navmeshes and moving platforms? (Drawbridges, Elevators, Monorail trains, etc) 1 Answer

Storing Vector3's and Detecting Gameobjects 1 Answer

How to know how far one object are from the corners of another object. 0 Answers

If Terrain is larger(width10000Xlength10000) then how to increase the size of the GridGraph of Astar Path Finder 0 Answers

How to structure the code for your AI enemy system? 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