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 sevensixtytwo · Apr 27, 2015 at 02:20 PM · terrainainavigationobstacle

Texture-based Terrain Navigation

Hallo all.

I've been looking for a way to get my AI to navigate the terrain intelligently. I would like them to prioritize the use of certain textures over others when calculating a path.

I have roads textured on a Unity terrain. I need the AI to prefer the roads when going from place to place unless cross-country is called for (no roads near destination point) and even then avoid areas with rough or rocky ground.

The terrain is 5km square and uses only one splatmap. I currently use a baked Navmesh and AI have custom navigation and steering scripts alongside the Navmesh Agent.

A push in the right direction would be much appreciated.

UPDATE: Found this thread over in the forums dealing specifically with my problem

Navmesh layers

Seeing as its four years old, I'm hoping that there'd be something new for this. Otherwise, the method in the thread will do.

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 Owen-Reynolds · May 08, 2015 at 03:37 AM 0
Share

Ahh...seems like the Q is really about how to set weights for the built-in pathfinding (I think.) The standard A* algorithm allows for a different weight for each node (say, a woods space taking 2 movement points.) I can't imagine Unity's doesn't.

$$anonymous$$ight be nice to have Unity auto-read this. But if you can read the terrain type of each space, one way or another that can be jammed into the node weights.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Owen-Reynolds · Apr 27, 2015 at 03:56 PM

You can read the painted ground texture amounts directly with getAlphaMaps.

Suppose you have three ground textures and the 00 map corner is the first two blended evenly. Meaning, the paint numbers are [0.5, 0.5, 0]. The results of getAlphaMaps shows it as: AM[0,0,0]=0.5, AN[0,0,1]=0.5 and AM[0,0,2]=0. The coords are the "painting squares" (the ones you see in the brush,) which are not the same as heightmap squares (the conversion math is a bit tricky.)

I think the command used to be named getSplatMaps. There are more detailed code examples here in UA, and that name might help you find them.

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 sevensixtytwo · Apr 28, 2015 at 12:23 AM 0
Share

Yes, I use the splat maps to detect whether a unit is crossing $$anonymous$$ud, Rock, or Dirt and toggling the appropriate particle effects, but now I want to piggyback it to the Navmesh so that the Agent will prefer certain textures over another.

Is there any way to influence Navmesh generation using getAlpha$$anonymous$$aps?

Thanks for taking the time to answer my question.

avatar image
0

Answer by DigitalCandy · Feb 14, 2017 at 10:27 AM

The proper way to do this would be to read the splatmap layers of your terrain one-by-one (easy), and then generate a navmesh layer for each of them, then simply assign far greater costs for the non-path layers. It would only need to be done once. However it seems building navmesh layers at runtime is currently not possible. Which is ridiculous, considering this would be a simple script, nobody wants to build separate meshes for each layer of each terrain, and its how most people would do navigation on a vast terrain using unitys own terrain tools :/

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

21 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

Related Questions

Automatic nav mesh generation 2 Answers

How to allow multiple nav mesh agents with different slope climbing abilities to use the same nav mesh? 0 Answers

help with not working AI system 2 Answers

Setting NavMesh from NavMeshTriangulation or Mesh 2 Answers

Painting or assigning NavMesh area's on terrain 3 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