The thing that attracted me to this asset was in the free demo I saw I could create a grid based pathfinding system, which seems perfect for discrete worlds, such as a voxel based procedural world (aka minecraft). For the voxel procedural generation I’m using the VoxelPlay2 asset. However I cannot figure out a way to use that asset (which generates voxel terrain procedurally, not with a “terrain” object), and this asset.
Unity’s NavMesh pathfinding is not well suited for voxel games. Below is a screenshot of the baked pathfinding in VoxelPlay2 using Unity’s NavMesh:
As you can see, this is very janky. It causes entities to miss certain paths, and to have jerky/teleporting behaviour.
What I’m looking for is a pathfinding solution where 1 grid cell can map to one voxel, eg:
X1 → X2 → X3 → X4
(where each X is a Voxel, and a path can be found by the pathfinder from X1 to X4 with only 4 checks).
As shown in the above screenshot, this isn’t possible in Unity’s NavMesh no matter how small I make the voxel size, since there’s no direct 1-1 mapping of unity’s voxels used in the pathfinding algorithm to the procedurally generated ones used in VoxelPlay2.
So my question is - is such a 1-1 mapping of grids to voxels possible with this asset, and particularly for a procedurally generated voxel based world?
I could not find a way to make this asset compatible with VoxelPlay2, it seems that the pathfinding algorithm doesn’t behave well with the procedural voxel generation. Any ideas? Has a solution been come up with before where a 1-1 mapping is possible?
The solution should be perfect, ie: no jankiness whatsoever. I believe this would be achievable with a 1-1 mapping of voxels to grid cells, since a path either exists or it doesn’t, instead of relying upon Unity’s finnicky Navmesh which isn’t well suited for voxels (it assumes a continuous terrain as opposed to the discrete terrain that is evident with voxels).
The other issue to tackle is of course the procedural generation. Whilst this asset may be able to map 1-1 grids with voxels, can it do so for voxels that are generated procedurally like in VoxelPlay2? If so, how?