I’m having problems with Getcontour and diagonal movement. I’m making a turn-based game and I want all units to block their node and move diagonally.
I tried using BFS, which resulted in the below, which also is what I’m after, but afaik I can’t use traversals and constraints on BFS? Which means I can’t block units’ nodes?
BFS Code:
return PathUtilities.BFS(srcTile.node, maxDistance);
When I tried using ConstantPath with the same input (only *1000 for the distance input) it resulted in this:
Which won’t take diagonals into account…
ConstantPath code:
ConstantPath path = ConstantPath.Construct(srcTile.GetPos(), maxDistance);
path.traversalProvider = GameControl.GetSelectedUnit().TraversalProvider;
NNConstraint constraint = NNConstraint.default;
constraint.distanceXZ = true;
if (!walkableOnly) constraint.constrainWalkability = false;
path.nnConstraint = constraint;
AstarPath.StartPath(path);
path.BlockUntilCalculated();
return path.allNodes;
TraversalProvider code:
blocker.manager = GridManager.blockManager;
traversalProvider = new BlockManager.TraversalProvider(GridManager.blockManager, BlockManager.BlockMode.AllExceptSelector, new List<SingleNodeBlocker> { blocker });
Any ideas/suggestions?