Scanning a Procedural World


Question: Is there a way to adapt the Recast Scan system to have it work with ECS colliders instead of GameObjects?

I am currently implementing pathfinding on a world. I’d like to use the FollowerEntity and Procedural Recast graph to do this.

I have created the agent entity, but I have an issue with the recast. I am currently using GPU Instancing and a DrawMesh variant to draw the world. So the meshes are being rendered, but there are no GameObjects to scan.

Maybe I could feed the pathfinding scan system the Mesh data directly instead of it having to scan it on GameObjects? Since I am generating the world meshes at runtime, that’s a data I can easily provide.

Thanks for the help. Hopefully there is a way to handle a case like this, and have pathfinding working on an entity-only world.

pd: of course, this will also lead me to the question on how to handle gravity. I have no GameObject colliders - everything is ECS. I will look into what is the exact system that handles gravity, to change the Raycast from checking on GameObject layers to Entity layers.

pd2: I am also going to use my own character controller solution, so I only need the path. What would be the way to tell ECS to calculate the path and grab it so I can do the movement on my own? I looked over at the documentation, and I know how to calculate the path from a GameObject monobehaviour, but it doesn’t say how exactly would it work on ECS. Thanks for the insight!

1 Like

I was about to ask the same question, I currently have GO doing some sort of “runtime baking” to ECS, but its starting to become really cumbersome to manage, so I am thinking in moving straight out to ECS, but this would require me to be able to bake the world at runtime from ECS data.

Really interested in seeing if there is a approach to do it.

1 Like


Currently, this is not possible, I’m afraid.

In the next version I’ll add RecastGraph.collectionSettings.onCollectMeshes which can be used to add custom meshes to be rasterized by the recast graph. This can be used if necessary to rasterize whatever you want. I also have plans to add ECS collider support to the recast graph, but I probably won’t have time in the near future.

1 Like

Thanks man, the onCollectMeshes will be perfect as I have the data of the meshes and can give them no problem.

May your recovery be swift.

1 Like