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 Steff00212 · Jul 22, 2019 at 05:56 PM · navmeshnavmeshagentnavigationnavagent

Creating a 3D Navmesh for a Spacegame

Hey guys. I am trying to create a little Space Shooter. I wanted to use Unity's built-in NavMeshAgent, but the problem is that it needs a NavMesh. And I don't know how, or if you can create a 3 dimensional NavMesh. Is there any way I can make the Spaceships navigate in x, y and z? Or do I need an invisible layer in order to make the NavMeshAgent work?

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 Cherno · Jul 22, 2019 at 06:11 PM 1
Share

A node-based pathfinding system is probably not the best solution for a game in which the world is almost completely empty with only a handful of obstacles over vast distances (some planets or asteroids, and other ships). A much simpler solution that is more suited to this environment would be one that utilized raycasting; cast a ray from origin to the target location and if there's something in the way, offset the current raycast target position until the path is clear again, and then cast again from this position toward the original target, and so on. Each step, you add the offset positions to a list which will then serve as the waypoints an objects needs to travel along.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by JonPQ · Jul 22, 2019 at 09:43 PM

Nav meshes work in 3D space, but the surfaces of the mesh are really 2D. or 2.5-D they can follow stairs and slopes up and down, and go over and under itself... but doesn't lend itself well to a truly 3d space. Depending on your level (space) layout.... I would suggest that you'd want a node based system instead... more like a 3d cube of node points... each point in space would be free or not-useable (inside solid object) then at each node you'd do a bunch of ray casts, to nearby nodes to build a tree. Then you could use modified A* search algorithm to find path to follow in arbitrary 3d space. You could also choose to make a tree where the nodes your raycast, are also further than just the nearest nodes, it would take longer to prepare your tree, but get better results. If your map is simple... you could probably place the nodes and link them by hand, and make a simple tool to connect nodes, visualizing them using OnDrawGizmos()
For A*, you could write it yourself, or buy one on asset store that comes with source code, and modify it a bit for 3d support.

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

115 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

Related Questions

How to edit baked navigation for better accuracy? 0 Answers

Unexpected Navmesh agent rotation 0 Answers

Unity Navagation Ground Mapping 1 Answer

NavMesh agent snaps to wrong mesh 0 Answers

Duplicated NavMesh Agents not moving 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