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 F_J · May 30, 2017 at 07:19 PM · c#ainavmeshlink

NavMesh link does not connect properly on runtime

I am using the latest version of Unity 2017.1f1 currently up-to-date.

What I am trying to do

In my 2.5D game, I am spawning enemies that will navigate towards the player while avoiding obstacles (with curving enabled) spawned in runtime. I also spawn a plane (on which the player and enemies moves) additively, I want the current plane navMesh surface to connect to the next spawned plane navMesh surface with a navMesh link so that the enemies can navigate to other planes via the link.

What is the Problem?

There are two issues happening:

  1. The link closer to the obstacle whose curving is enabled do not get connected to the next plane.

  2. Since the player can run right and left I rotate the plane according to the direction the player is facing, however rotating the plane at 180 degrees, while it's direction is equal to Vector3.Down (which is (0,-1,0)) the navMesh links on that plane do not connect to its neighboring planes in runtime.

My Implementation

First of all, I am using the navMesh components provided by Unity on GitHub to achieve this in runtime. Now when I spawn the plane additively I first build the navMesh surface then update its attached links.

 nextPlaneSurface.BuildNavMesh();
 for (int i = 0; i < nextPlaneLinks.Length; i++) {
     nextPlaneLinks[i].UpdateLink();
 }

Next, I update the current plane (which the player is on) navMesh links to connect with the newly spawned plane navMesh surface.

 for (int i = 0; i < currPlaneLinks.Length; i++) {
     currPlaneLinks[i].UpdateLink();
 }

What I have tried to fix the problem

For the first problem:-

  • Updating the current links and rebuilding the navMesh before and after spawning the obstacles.

  • Updating only the current links before and after spawning the obstacles.

For the second problem:-

  • I am out of clues, I have no idea what's causing this :(

Will really appreciate if anyone can help me out, also if you guys can explain what's happening internally in the unity scripts that will be really helpful. After all, I am having these problems because I don't understand the concept properly.

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 F_J · Apr 10, 2018 at 01:28 PM

I finally found the solution to my problem, the reason why I wasn't able to link the two planes was that the Navmesh surface tile size was too large. After reducing the tile size the link was connecting with the obstacles on the planes.

For a beginner, you can find tile size field under NavMeshSurface component (provided by Unity on GitHub) in advance section.

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

My ai is getting stuck when there is a lot of them 0 Answers

Editing NavMesh Paths? 0 Answers

NavMeshAgent resume original position and facing direction C# 0 Answers

Need help detecting barriers for my game 0 Answers

Connecting two navmeshes without "Speedboost" 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