- A* version: 5.2.4
- Unity version: 6
Couldn’t find a definitive answer here in forums. Is there a way to check the density at a position within an ISystem? Basically I need my agents do something else if there’s already a bunch of agents squatting at the destination.
Sure.
You can do something like this (pseudocode):
struct MyJob : IJob {
[ReadOnly]
public RVOQuadtreeBurst quadtree;
void Execute () {
var area = quadtree.QueryArea(somePoint, someRadius);
}
}
void Schedule() {
var simulator = RVOSimulator.active?.GetSimulator();
var writeLock = simulator.LockSimulationDataReadWrite();
systemState.Dependency = new MyJob {
quadtree = simulator.quadtree,
}.Schedule();
writeLock.UnlockAfter(systemState.Dependency);
}
Take a look at the RVOSystem.cs file for more inspiration.
1 Like