- A* version: 5.3.1
- Unity version: 6.0.33f1
Would be nice if there was proper support for multiple physics worlds (there seem to be stabs to support this in various areas in the code base). In our case, we’re doing scene stacking to host multiple sessions in a single server instance. Unfortunately RecastGraph and most provided agent implementations use Physics.XYZ straight off. RecastGraph seem to always collect its colliders based on the scene that happen to own the Astar instance etc.
We’ve patched all calls in AIBase, added some extra overrides via RecastGraph.CollectionSettings etc. But it feels a bit hacky, would be nice to have this support straight out of the box.
1 Like
Hi
Yes, support for this is a bit spotty.
The FollowerEntity can use any physics scene if you set the PhysicsSceneRef
component on the FollowerEntity.entity
.
See PhysicsSceneRef - A* Pathfinding Project
The recast graph can, as you’ve seen, change its physics scene, but it does require some minor code changes to actually expose it. Did the changes work well for you?
We’re running our own agent implementation, which relies on the RVOController
, so we didnt have any need to patch the FollowerEntity
etc. Most work was finding all hard scene references and Physics
namespace calls. Main changes has been done in RecastGraph.cs
, RecastMeshGatherer.cs
and TileBuilder.cs
. And we use the methods exposed by the graphs via the IRaycastableGraph
interface, instead of using the methods exposed by the AstarPath singleton. Basically to ensure that the correct graph is used, since we cant figure out the closest graph to a specific point using the regular method, as all graphs are essentially stacked in the same world space bounds. We also did a change to make sure we have control over which scene the AstarPath singleton lives in.
It still feels like a bit of a hack though. Would be nice with out-of-the-box support, we could provide our changes if that is of interest.
I’ll include RecastGraph.collectionSettings.physicsScene and RecastGraph.collectionSettings.physicsScene2D to allow specifying which physics scene to use when scanning a recast graph, in the next update.