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 /
  • Help Room /
avatar image
2
Question by mokabiri · Jul 11, 2017 at 09:43 AM · networkingnavmeshpathfindingnavigation

Multi-Floor, Levels pathfinding with Navmesh

Hello,

I'm working on a project on the unity 5.6.1 to draw the path between two Gameobjects on the different floors (Levels). in my project I have just two levels. I have used the Sketchup to create my model with two floors and staircase (stair)to connect them together =>export Dae extension.

On the Unity, I'm using Unity's built-in pathfinding engine, i build a Navmesh for the first floor, stair and second floor. I put the different Gameobjects on the scene, with the color blue and orange, the oranges are the origin and the blue is the destination. i have attached LineRender and NavmeshAgent to origin Gameobject, when i try to draw the path between two Gameobjects on the different floor i have achieved these results:

Origin(Orange color) on the first floor and the destination(blue color) on the second(the path is not across the stair: alt text

Another problem, two GameObjects on the same floor(Second floor).the path is not correctly drawn.

alt text It's work correctly, when the destination GameObject is on the first floor.
Idon't know what is the problem, can you help me to find the problem please ? Thank you for taking your time reading my question.

     void Update()
 {    
     //Get the postion one of the orange's gameobjet  on the scene,
              and set it to origin gameobject(attached lineRenderer, NavmeshAgent 
             and the script to it)
     //Cube -> First floor , Cube(1) --> first floor, 
     //Cube(2) --> second floor  
     this.transform.position=  GameObject.Find("Cube").transform.position;
     OnDrawGiz(GameObject.Find("Destination"));


 }//end update 
     
 void OnDrawGiz(GameObject obj)
 {
     //Destroy GameObjects 
     Transform target = 
             obj.GetComponent<Transform> ();
     NavMeshAgent nav;

     LineRenderer line;
     nav= this.GetComponent<NavMeshAgent>();
     if( nav == null || nav.path == null )
         return;
     line = this.GetComponent<LineRenderer>();
     line.material = new Material( Shader.Find( "Sprites/Default" ) ) { color = Color.yellow };

     line.startColor=Color.yellow;
     line.endColor = Color.green;

     nav.SetDestination (target.position);
     //nav.isStopped=true;
     var path = nav.path;
     if (path.corners.Length < 2)
         return ;

     line.positionCount=path.corners.Length ;
     //line.alignment = LineAlignment.Local;
     //Draw the line
     for( int i = 0; i < path.corners.Length; i++ )
     {
         line.SetPosition( i, path.corners[i] );

     }

 }
 }


capture-decran-2017-07-11-a-102452.png (234.6 kB)
capture-decran-2017-07-11-a-103009.png (217.5 kB)
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by mokabiri · Jul 11, 2017 at 09:45 AM

The Navmesh Configuration in my project : alt text


capture-decran-2017-07-11-a-114425.png (93.6 kB)
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
avatar image
0

Answer by Toddweiss · Sep 04, 2019 at 03:23 AM

Does anyone have a solution for this??? is this solved?

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

139 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 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

Farthest Reachable Destination 0 Answers

Second NavMesh Surface refuses to cooperate: Failed to create agent because it is not close enough to the NavMesh 0 Answers

How to exclude certain navmesh obstacles on runtime? 2 Answers

How to go about pathfinding for fast roll-a-ball racing game 0 Answers

Off Mesh Link - Limiting access to certain agents 2 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