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
0
Question by DanSuper · Mar 01, 2013 at 10:11 PM · rigidbodynavmeshnavmeshagent

How to stop a Navmeshagent from teleporting when the navmesh overlaps in Z

I've been trying to use the NavmeshAgent to create some minion characters that follow the player around in 2D sidescroller game.

One of the biggest issues I've found with this is that if a NavMeshAgent is pathing to a destination and passes a place where the Navmesh overlaps in the Z direction it will teleport in the Z axis to the destination instead of going around to the OffmeshLink which it should be using. Hopefully this picture will help you see what I mean.

alt text

I've noticed that the Navmeshagent will only exhibit this behavior if it either has no Rigidbody attached or the Rigidbody is set to be kinematic. However giving the agent a non-kinematic rigidbody adds a whole other set of problems where the physics and navmeshagent seem to interfere with each other.

Has anyone else experienced this teleporting behavior with navmesh areas that overlap in Z? Can anyone point out what I'm doing wrong here?

actualpatghvsintedpath.png (17.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 Tudor · Nov 11, 2013 at 10:49 AM 0
Share

I've just experienced the same problem. And pretty much am in the same situation as you. Can't use rigidbody. I don't know enough about how unity's navmeshes work to figure this out, but hopefully someone else here can help us.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Tudor · Nov 13, 2013 at 11:32 AM

I seem to have found a workaround to the problem. I don't use off mesh links, instead I handle movement manually for the transition between two planes. So let's say I have my minion walk to the edge of the navmesh, then teleport to the other navmesh plane. But this way, it appears that when you teleport a minion to a new plane, the navmesh agent still thinks it is on the previous plane.

I couldn't figure out how to tell the navmesh agent which plane it should think it's on, but this is how to trick it to work:

 //disable everything agent related
 navmeshAgent.Stop(true);
 navmeshAgent.updatePosition = false;
 navmeshAgent.updateRotation = false;
 //this is the most important part; turn the agent off:
 navmeshAgent.enabled = false;
 
 //do your nasty teleporting/flying stuff
 teleportMinion();
 
 //restore everything
 navmeshAgent.enabled = true;
 navmeshAgent.updatePosition = true;
 navmeshAgent.updateRotation = true;

This should work regardless of where your two separate navmesh planes are in relation to each other.

I am still curious to see how to actually control how the agent decides to use the off mesh links, but for now this will have to do.

Comment
Add comment · Show 2 · 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 storedenen · Jan 20, 2015 at 08:57 PM 0
Share

I had a strange problem after I positioned my charater object on the map and couldn't figure it out why it is teleporting before the first movement. $$anonymous$$y character teleported back to another position and started the first movement from that position if I did not disabled the Nav$$anonymous$$eshAgent while I modified the position of the object. Tudor you are great! Thanks man! I almost gave up to fix this and started thinking about other solutions... Thank you once more! I'm really happy now! :)

avatar image meat5000 ♦ · Jan 20, 2015 at 08:58 PM 0
Share

Click the tick to accept the answer.

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

11 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

Related Questions

Movement with NavMeshAgent pushes RigidBody 1 Answer

Navmesh problem with characters rotation in the terrain 1 Answer

A little help with using Navmesh agents with RigidBody physics. 0 Answers

Is there a way to limit the size of a navmesh? 0 Answers

Navmesh agent does not operate after building the project 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