Recast agent configuration (reduce pushing effect)

1) How to stop agent faster ?

Maybe you didn’t understand what I was explaining, currently I already check for low velocity to stop agent and use teleport. This technique works fine but bring new problems.

When manipulating a large amount of unit, let’s say 20, some units cannot move because of others (first units must move in order to the other follow), so they immediately stop because low velocity. We need to “remember” the move order : the unit, for example, wait 100ms and retry a move.

I just finished to implement system like that (not without headaches :sweat_smile:)

But all this has also a another consequence : after using teleport, an agent is not moving and stop acting as an obstacle (strange behavior from Recast by the way). As the result we have to add/remove obstacle each time the agent stop/start moving, like you suggested in this comment.

I got something almost working, but sadly it seems that the obstacle is not removed faster, as the result : when the agent restart moving he is abnormally translated a little bit before restart.

Each character have this method :

private setAsObstacle(value: boolean): void {
  if (value) {
    let position: Vector3 = this.crowd.getAgentPosition(this.navigationAgentIndex);
    this.navigationObstacle = this.navigationPlugin.addCylinderObstacle(
      position,
      this.getConfig().agentParams.radius,
      this.getConfig().agentParams.height);
    console.debug(`[agent ${this.navigationAgentIndex}] add obstacle at ${position}`);
  } else {
    if (this.navigationObstacle) {
      this.navigationPlugin.removeObstacle(this.navigationObstacle);
      console.debug(`[agent ${this.navigationAgentIndex}] remove obstacle}`);
    }
  }
 // this.crowd.update(this.scene.deltaTime);    // bonus test (ugly result)
}

Without using this method, it works perfectly. But when I to set an obstacle when the character stop (at character position with same radius), the character restart with a small unexpected translation. I have tried to remove the obstacle, wait 1 second, and start moving, but it changes nothing.

By curiosity I also tried to update crowd with update method but I think I did not understand something, the result is very strange. Also I use webworkers.

UPDATE: all this is coming “just” because agents keep moving all the time (video). I think we should be able to specify a kind of a precision or something in order to just stop.
You also spoke about a maximum number of obstacles, i found nothing in the documentation. Do you know the limit ? (I plan to get hundreds of units :smiling_face_with_tear:)

2) How to reduce agent pushing effect ?
My bad sorry.

Thank you