Possible to have a static agent in Recast navmesh?

Hey everyone,

I want to be able to have a static agent in recast navigation, e.g. one that doesn’t get pushed by the crowd.

I think if I could manually set the state of a agent to say it’s gone off the mesh that would do but can’t find anything in the source.

In the example playground if you close the door on a agent, agents can no longer push them.

My goal is to have a player that doesn’t get pushed around by the crowd, I plan on controlling the player updating by using the teleport function (I can probably use the static agents as other other barriers etc)

Any ideas? or perhaps a better way to do it?

https://playground.babylonjs.com/#WCSDE1#16

@Cedric is the king of navmesh

hi @kestrelpi

I would use obstacles with the size of your agent:

if agent switches between dynamic/static, I would create/delete obstacles and add/remove the corresponding agent.

Out of interest, why do the agents that are ‘stuck’ below the door stop moving at all?
If the door goes up, the tile of the navmesh should be passable again right?

Thanks Cedric, I did try that out but that would cause other agents to stop working when placing the obstacles - I might take another look at the source and see if I can manually set the state of a agent to be “off mesh” so they become static.

@Censor it’s because they are detected as off mesh when they are under the door, I guess it’s to stop artifacts etc. from happening

Okay managed to get what I was after

https://playground.babylonjs.com/#WCSDE1#17

Just had to set the agent I didn’t want to move params to the following:

maxAcceleration: 0,
maxSpeed: 0,
collisionQueryRange: 0

Getting amazing performance with it and instances, thanks for implementing it!

3 Likes