Unity Community


Results 1 to 5 of 5

  1. Posts
    127

    NavMeshAgent's velocity and desired velocity randomly dropping to 0.

    In my game I have anywhere from 0-20 navmeshagents present at one time, but I am experience an issue randomly when new agents are added to the game at runtime. Sometimes it appears that when new agents are added, existing agents velocity and desired velocity will immediately go to 0 for a few frames, then slowly accelerate back to normal.

    Below is the debug output I am getting when this happens.

    AGENT: 2.6 VELOCITY: (1.6, -0.4, -2.1) DES VELOCITY: (1.6, 0.0, -2.1)
    AGENT: 2.6 VELOCITY: (1.6, -0.4, -2.1) DES VELOCITY: (1.6, 0.0, -2.1)
    AGENT: 2.6 VELOCITY: (1.6, -0.4, -2.1) DES VELOCITY: (1.6, 0.0, -2.1)
    AGENT: 2.6 VELOCITY: (1.6, -0.4, -2.1) DES VELOCITY: (1.6, 0.0, -2.1)
    AGENT: 2.6 VELOCITY: (1.6, -0.4, -2.1) DES VELOCITY: (1.6, 0.0, -2.1)
    AGENT: 2.6 VELOCITY: (0.0, 0.0, 0.0) DES VELOCITY: (0.0, 0.0, 0.0)
    AGENT: 2.6 VELOCITY: (0.0, 0.0, 0.0) DES VELOCITY: (0.0, 0.0, 0.0)
    AGENT: 2.6 VELOCITY: (0.0, 0.0, 0.0) DES VELOCITY: (0.0, 0.0, 0.0)
    AGENT: 2.6 VELOCITY: (0.0, -0.4, 0.0) DES VELOCITY: (1.7, 0.0, -2.0)
    AGENT: 2.6 VELOCITY: (0.0, -0.4, 0.0) DES VELOCITY: (1.7, 0.0, -2.0)
    AGENT: 2.6 VELOCITY: (0.0, -0.4, 0.0) DES VELOCITY: (1.7, 0.0, -2.0)
    AGENT: 2.6 VELOCITY: (0.0, -0.4, 0.0) DES VELOCITY: (1.7, 0.0, -2.0)
    AGENT: 2.6 VELOCITY: (0.1, -0.3, -0.1) DES VELOCITY: (1.7, 0.0, -2.0)


    This output is without obstacle avoidance off, but it appears to happen whether or not obstacle avoidance is used. I'm not sure what would be causing this, but when this does happen, it seems to happen to all navmeshagents that are currently in the scene at the same time, causing strange looking stuttering in the characters on screen.

    If anyone has any idea why this is happening it would be a great help, because if I cannot fix this I will have to ditch unity's new pathfinding completely as this is really a show stopping issue.


  2. Posts
    736
    It's hard to tell without seeing the code. Could it be that the GC is at work?


  3. Posts
    127
    Quote Originally Posted by Diablo View Post
    It's hard to tell without seeing the code. Could it be that the GC is at work?
    That seems unlikely. I actually pool every object in the game so almost nothing is created or destroyed during the game itself, just disable and re-enabled. Normally I would think this has something to do with my code, but every navmeshagent has the issue at the exact same time for the same duration when it does happen.

  4. Unity Developer

    Location
    Unity HQ - Copenhangen / Denmark
    Posts
    42
    Is this still a problem with the latest 3.5 - if so _please_ file a bug with the scene/project - or ping me.

    Cheers..
    /Jakob


  5. Posts
    5
    Just want to let you know that this is still an issue with Unity 4.0 Pro. I have one larger group of navmeshagents chasing another smaller one, and every now and then the larger group will suddenly come to an immediate stop and slowly accellerate back up, giving the smaller group an undesired advantage as they don't stop.
    My game prototype is available on victorknai.webs.com, under the headline Rapid Game Development - Week 1.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •