Navmesh - Agent stuck with dynamic obstacle

Hi @Cedric

I noticed this when I was playing with the example PG in the Navmesh documentation. Steps to reproduce it:

  1. Click Toggle Door button to remove obstacle
  2. Move agent cube to the position of obstacle
  3. Add back obstacle. The cube should be overlapping with the obstacle. Click on the ground the cube is not moving.
  4. Remove obstacle. The cube is not moving any more.

Is this expected behavior? If I call agentTeleport to get the cube out from the obstacle position, the agent is able to move again.

Thanks for helping!

1 Like

Interesting find. I definitely can repo this behavior and it does seem strange.

Curious to hear @Cedric’s thoughts.

This one based on patroljs has been good for me:
.Babynav

noteworthy:
.three-pathfinding demo

for whatever reason, the threejs one always gets stuck for me. try going to the top of the platform and then back down, the ball gets stuck at the bottom of the stairs for me. the babylon one doesn’t. always chucked it up to threejs people arbitrarily changing shit they didnt write. maybe the patroljs version can give some insight, idk.

That’s by design. The program should detect and handle these edge cases. For example, killing the agent when a door closes on him. Or not allowing to close the door. It all depends on the use case.
Anyway, there is a way to detect agent is stuck. getAgentState ICrowd | Babylon.js Documentation returns 1 when everything is OK. and 0 when stuck.

2 Likes