- A* version: [5.2.4]
- Unity version: [2022.3.52f1]
As you can guess from the title and category, I have a Recast Graph and I’m Generating a ConstantPath to define the movement range of my character.
Things we’re working pretty fine until I realized that my ConstantPath is a square. I’d like to have circle, since in my case I want the character to move 10M in any direction for example.
At first I thought the heuristic was the issue, I’ve tried to change it from Manhattan, to Diagonal Manhattan, to Euclidean but nothing changed.
Any insight on how I could achieve this or where to look into?
Thanks in advance and please let me know if you need more information
I managed to achieve this, but I’m convinced that my method is not the right way. Any feedback is welcome.
Are you able to also post a screenshot of your Recast settings and your agent settings?
Sure thing,
My agent
I also have a seeker & funnel modifier on my agent that I use to create a path visualizer line when hovering over my terrain
Hm, let me tag @aron_granberg on this because I’m seeing the same thing, but only in Recast Graphs, not Grid Graphs. I’m not sure if ConstantPath is “supposed” to work like this on Recast Graphs or not. It’s worth mentioning btw, that you have a pretty dense Recast Graph, with very low Voxel Size and Tile Size settings. Maybe if you want the grid-like behavior the Grid Graph is your best bet here?
Recast:
Grid:
I’m thinking the combination of dense Recast Graph + ConstantPath is what’s causing this result.
I’m working with (sort of complex) terrain and thought that a Recast Graph was better suited for this, hence why I chose it over a Grid Graph.
When I took a look at all the example scenes, the Recast Graph scenes looked the closest to what I need.
That’s fair- I’d say you made the better choice with the Recast Graph then. I’m sure Aron will have some useful insight here
1 Like
Hi
This is to be expected on a recast graph.
The constant path uses the pathfinding distance. And on recast graphs, the pathfinding is done between the sides of the triangles. This is not a perfect distance measurement, and this is why it looks more like a square than a circle.
I think you can visualize how the paths themselves look by enabling “Show Connections” on the recast graph, and then enable “Show Search Tree” in A* Inspector → Settings → Debug.
A grid graph will give you a bit more accurate data in this case.
Are you visualizing this range at all? If not, then you can calculate the path and then apply the Funnel Modifier to it, to simplify the path and get a much better distance measurement. This will only work for a single destination point, though. It cannot be used to get all points within a given distance.
1 Like
That is exactly what I’ve done haha, I’ve removed the constant path since I’m not planning on visualizing it.
Still it’s a good thing to know that this is the expected behaviour. Thanks!