Accessing Recast Graph Raster Data

I am working on a system for the AI in my game where a “point cloud” of sorts is built in real-time by individual AI agents wandering the environment.

The current system works by casting a series of raycasts out and storing the hit points in an array. This is a very expensive process to compute and I feel like I am essentially recalculating data that A* has already done (I am using the recast graph).

This brings us to my question - Is there a way I can access the “raster data” produced when a recast graph is scanned? From my understanding, it is stored in some kind of voxel structure. I am not talking about the graph itself but the data the graph is built from.

Hi

The rasterized data is normally thrown away after calculating the graph (it uses a ton of memory, and isn’t needed later). However you could access it in the RecastGraph.BuildTileMesh method. After the VoxelizeInput method has been called, the raw voxelization data is available, and then some additional post processing is done on that.

Note however that this data is really not stored in a way that makes it easy to use raycasting on it.

Perhaps you should check out Unity’s RaycastCommand which allows you to calculate raycasts in parallel using the new job system? https://docs.unity3d.com/2018.1/Documentation/ScriptReference/RaycastCommand.html

Thanks for the quick and detailed reply Aron!

Hmm, sounds like the RaycastCommand option is the way to go here, I’ll give it a shot!

1 Like