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 m3an · May 07, 2018 at 09:45 AM · navmeshnavmeshagent

Navh Mesh Agents teleporting to spot instead of staying on Nav Mesh

Hey there,

I'm trying to place moveable towers on a Nav Mesh (think Tower Defense, but with Rails). To prototype this idea, I've used the Tower Defense Dev Kit from Unity. Basically, I've just changed the base tower to be a moveable and selectable agent and created a Nav Mesh for enemies and Nav Mesh for Towers. That works just fine, but when placing the towers during runtime, the agents do not stay on the Nav Mesh they've been placed on, but instead teleport to a certain spot on a different Mesh that is not connected to the Mesh the towers have been placed on.

I put together a couple of screenshots to visualize the problem: https://i.imgur.com/ncHXu2J.jpg

  1. Pic = Nav Meshes and tower placement points (blue+arrow)

  2. Pic = Placeing first tower (works fine).

  3. Pic = First tower in place and trying to place second tower.

  4. Pic = The second tower teleports to another location, instead of behaving like Tower #1 which stayed in place.

I've noticed that all (additional) towers jump to that specific point where the second tower went.

I'd really appreciate any tips or hints on how to get this working! I've tried for a week now, but I'm not familiar enough with Unity to get this done, as it seems. Cheers!

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
2

Answer by tormentoarmagedoom · May 07, 2018 at 10:14 AM

Good day.

We ened to see the code is using to place the towers, but as a tip, when using navmesh system, and want to move/place something, once you instantiate the object, is recomended to:

1 - Instantiate

2- change transform.position = PositionYouWant

3- Do a NavMeshAgent.Warp = PositionYouwant

This way you make sure Unity recognise that the object you moving must be in the navmesh area.

I don't know if this solve your issue, but if not, i think is because some script is changing its posotions. Try to find why!

Bye!

Comment
Add comment · Show 5 · 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 m3an · May 07, 2018 at 10:36 AM 0
Share

Thank you! I'll try this out and report back with results.

avatar image tormentoarmagedoom m3an · May 08, 2018 at 07:57 AM 0
Share

Accept the answer ! :D It works for sure :D :D

avatar image Harinezumi · May 07, 2018 at 11:33 AM 0
Share

Good points! It can also help if you have the Nav$$anonymous$$eshAgent disabled when instantiating, and only enable it after it was created.
Another thought, the issue might be related to the size of the Nav$$anonymous$$eshAgent, that is, too big for the navmesh area it wants to be placed on.

avatar image tormentoarmagedoom Harinezumi · May 08, 2018 at 07:57 AM 1
Share

Good day @Harinezumi

the problem of "if you have the Nav$$anonymous$$eshAgent disabled when instantiating, and only enable it after it",

Is that sometimes (i don't know exactly why) the object moves a liottle (or a lot) when you activate the navmesh. With the Warp function, you ensure the navmeshagent capsule is placed exactly over the NavmeshArea point you selected (if it has a navmesharea, of course :D)

avatar image Harinezumi tormentoarmagedoom · May 08, 2018 at 08:14 AM 0
Share

Good day to you too @tormentoarmagedoom ! :)
I didn't know about this, but I can imagine that that happens in practice, navmeshes can cause unexpected behaviours. Thanks for the info!

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

86 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

Related Questions

Trouble with Navmesh Agent and Navmesh Obstacle 0 Answers

Navigation Agent "Clipping" (Going inside) Navmesh Deadzone?... 1 Answer

Deleted component errors, yet component is still visible in inspector? 0 Answers

NavMesh Lookat causes jittery glitch in character 0 Answers

What is the difference between configuration of agent in 'Agents' tab and in 'Bake' tab Unity? 1 Answer


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