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 CarterG81 · Oct 10, 2017 at 08:24 PM · navmeshnavmeshagentnavigationnavagent

Removing 100ms Delay in NavMeshAgent moving to destination?

After setting the destination & unstopping the NavMeshAgent

     myNavMeshAgent.SetDestination(targetposition);
     myNavMeshAgent.isStopped = false;

And the actual character moving (changing position)

         if (transform.position != startingPOS)
         {
             Debug.Log("Position Changed: ElapsedMilliseconds: "
                         + MasterWorld.stopWatch.ElapsedMilliseconds);
         }

There is a 100ms delay. This creates significant input lag. Unacceptable. However, I would really like to keep navMeshagent.UpdatePosition = true (not have to create my own system to handle movement).

Is there a better method to use to start movement, other than .isStopped? I would like movement to start instantly, not 100ms after isStopped = false. Preferably without having to manually handle everything in code myself (only using NavMeshAgent to determine path.)

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 CarterG81 · Oct 10, 2017 at 10:30 PM

The delay was caused by SetDestination() taking too long to calculate the path.

I didn't think this would be the answer, since the path was extremely simple (straight line, no obstacles).

So this input lag is not avoidable (unless I'm generating my navmesh incorrectly).

Instead, I'll need to add some predictive movement. By keeping UpdatePosition = true, my custom movement code will still remain in the limits of the navmeshsurface. So I can just start moving the character.

Something like a coroutine...

 while(myNavMeshAgent.PathPending)
 {
     ImmediatelyMoveToDestination() //Manually move character
 }
 //When Path has finally been calculated
 myNavMeshAgent.IsStopped = false; //Or just stop manual movement & allow automated pathfinding to take over

Comment
Add comment · Show 1 · 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 CarterG81 · Oct 11, 2017 at 03:26 AM 0
Share

This seemed to be impossible to fix.

myNav$$anonymous$$eshAgent.PathPending would report false, when it was still true. Falsely reporting would result in random input lag (whenever it falsely reported) while it my predictive movement method was called if it was correctly reported.

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

73 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

Related Questions

Unity Navagation Ground Mapping 1 Answer

Duplicated NavMesh Agents not moving 0 Answers

NavMesh agent snaps to wrong mesh 0 Answers

Creating a 3D Navmesh for a Spacegame 1 Answer

NavMeshAgent not crossing over certain tiles 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