the crowd parameters
const crowd = new Crowd(navMesh, {
maxAgents: 100,
maxAgentRadius: 1,
});
The agents in the crowd.
The NavMesh the crowd is interacting with.
The NavMeshQuery used to find nearest polys for commands
Adds a new agent to the crowd.
Gets the agent for the specified index, or null if no agent has the given index.
Returns all the agents managed by the crowd.
Gets the query filter for the specified index.
the index of the query filter to retrieve, (min 0, max 15)
the query filter
Removes the agent from the crowd.
Steps the crowd forward in time with a fixed time step.
There are two modes. The simple mode is fixed timestepping without interpolation. In this case you only use the first argument. The second case uses interpolation. In that you also provide the time since the function was last used, as well as the maximum fixed timesteps to take.
The fixed time step size to use.
Optional
timeSinceLastCalled: numberThe time elapsed since the function was last called.
Optional
maxSubSteps: numberMaximum number of fixed steps to take per function call.
const deltaTime = 1 / 60;
crowd.update(deltaTime);
crowd.update(timeSinceLastUpdate);
const deltaTime = 1 / 60;
const maxSubSteps = 10;
crowd.update(deltaTime, timeSinceLastUpdate, maxSubSteps);
console.log(agent.interpolatedPosition);
the navmesh the crowd will use for planning