• 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 niflying · Feb 28, 2018 at 06:08 AM · ainavmeshnavmeshagent

How to move NavMeshAgent from NavMeshSurface A to NavMeshSurface B.

Hi guys,

I need my character cross NavmeshSurface A to NavmeshSurface B. I build a scene like this: If I use navmeshAgent.SetDestination() to move. The character can move from A to B. But, NavMeshAgent.move() cann't move character from A to B. alt text alt text

How to use NavMeshAgent.move to move character from A to B?

Please Help.

Thanks.

Test project download:

https://github.com/niflying/NavMeshsurfaceTest/raw/master/NavTest.zip

20180228141043.png (50.2 kB)
20180228134732.png (66.2 kB)
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 Harinezumi · Feb 28, 2018 at 09:35 AM 0
Share

A dirty way to do this is to detect when you are at the edge of one Nav$$anonymous$$eshsurface then disable the Nav$$anonymous$$eshAgent component, move it onto the other surface manually, and enable it again. But I would do what adriant is recommending.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by adriant · Feb 28, 2018 at 08:31 AM

Hi, NavMeshAgent.Move() confines the movement to only the NavMesh island that the agent is on. You need to make the agent move onto the link between the two surfaces more or less manually, and the only way I can think of to do that is to give it a path (by calling either .SetDestination() or .SetPath()) and let it navigate by itself until it jumps on the link. Once the link has been traversed (automatically or manually, in which case NavMeshAgent.CompleteOffMeshLink() needs to be called) the agent will be on the other surface and Move() will work. NavMeshLinks can be created/modified at runtime to connect the current position of the agent to a position on the other surface.

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

129 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

Related Questions

Navmesh agent forward movement 1 Answer

is it possible to use navmesh on flying character and target ? 0 Answers

How to speed up built-in Unity pathfinding using navMesh? 1 Answer

Navmeshagent runs in circles 2 Answers

NavMesh Agent Obstacle Avoidance Ignore 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges