# Crowd Agents Bug

**URL:** <https://forum.babylonjs.com/t/crowd-agents-bug/15508>\
**Category:** Bugs\
**Created:** [November 8, 2020, 10:55am UTC](https://forum.babylonjs.com/t/crowd-agents-bug/15508 "2020-11-08T10:55:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nevergrind](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/nevergrind/32/3792_2.png) [@Nevergrind](https://forum.babylonjs.com/u/Nevergrind)\
**Post date:** [November 8, 2020, 10:55am UTC](https://forum.babylonjs.com/t/crowd-agents-bug/15508/1 "2020-11-08T10:55:02Z")

</div>

Agents movements gets messed up when you switch to another tab (blur tab/browser).  
To reproduce that

- open [https://www.babylonjs-playground.com/#X5XCVT#240](https://www.babylonjs-playground.com/#X5XCVT#240)
- click to move your agent
- switch tab while agent is still moving
- wait a few seconds
- switch back to tab

 ![cc bug](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/8/8d8e655996a0e8d5b9a5375ed3d8d852ea42e862.png)

As i know @Cedric is working on the navmesh/crowd

Edit: Maybe i had to specify that i am using electron with disabled background throttling and this still happens.

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [November 9, 2020, 8:29am UTC](https://forum.babylonjs.com/t/crowd-agents-bug/15508/2 "2020-11-09T08:29:59Z")

</div>

Hi @Nevergrind

I can reproduce the issue but I have no good workaround for now.  
It looks like the navigation doesn’t update the path segment to use and agents keep going the same direction. It might be because of a big delta time time when tab is switched back. I’m investigating.

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [November 9, 2020, 9:49am UTC](https://forum.babylonjs.com/t/crowd-agents-bug/15508/3 "2020-11-09T09:49:33Z")

</div>

PR [set/get delta step and step count for navigation tick update by CedricGuillemet · Pull Request #9372 · BabylonJS/Babylon.js · GitHub](https://github.com/BabylonJS/Babylon.js/pull/9372)

---

<div class="post-metadata">

**Author:** ![Nevergrind](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/nevergrind/32/3792_2.png) [@Nevergrind](https://forum.babylonjs.com/u/Nevergrind)\
**Post date:** [November 9, 2020, 10:16am UTC](https://forum.babylonjs.com/t/crowd-agents-bug/15508/4 "2020-11-09T10:16:58Z")

</div>

@Cerdic Nice, it’s working as a charm.
