Nearest point implementation // RVO issue

Hi everyone I have a question.

  1. How to correctly implement https://arongranberg.com/astar/docs/class_pathfinding_1_1_path_utilities.php#ad7b708f2886466e46db7dae5dc1ee4e2

While testing I have also stumbled upon an RVO simulator fps issue. Am i doing something wrong or should i change something? This is with just one enemy present in the scene

Hi

The RVO simulator is multithreaded, the profiler screenshot says that the RVO simulator is waiting for a thread to finish calculating. I’m not sure why it is that slow though… Are you using a huge number of RVO obstacles? (currently they are not that optimized, however I find it hard to believe it would cause it to be that slow with just one enemy anyway).

Here is some sample code for it

// using System.Linq;
List<Transform> agents = ...;
List<Vector3> currentPositions = agents.Select(a => a.position).ToList();
Vector3 destination = ...;
var agentRadius = 0.5f;
var graph = AstarPath.active.data.graphs[0] as IRaycastableGraph;
PathUtilities.GetPointsAroundPointWorld(destination, graph, currentPositions, 0, agentRadius * 2);

for (int i = 0; i < agents.Count; i++) {
	// Set the destination of agents[i] to currentPositions[i]
}

See also PathUtilities.GetPointsAroundPoint() not returning points

I updated Unity to the newest version and it seems to be a lot better however it still reduces my fps a lot with only 70-80 agents present (all taken by RVOSimulator.Update.

Thanks you for the sample code

PS I am only using dynamic rvo obstacle on instantiated objects and they were not present in the scene at the time of testing

Update 1: With around 200 agents my fps drops to 40 in editor