For example, I’m trying to add a “minimum” height between 2 walkable nodes for them to be 2 distinct layers in a LayerGridGraph. So I’d need to check if a walkable node has at least that minimum distance between the walkable node above it.
What I have so far:
public override void Register(GridGraphRules rules)
{
// Register this rule with the grid graph
rules.AddMainThreadPass(Pass.BeforeConnections, this._EvaluateWalkability);
}
private void _EvaluateWalkability(GridGraphRules.Context context)
{
var _nodePositions = context.data.nodes.positions;
var _nodeWalkability = context.data.nodes.walkable;
LayerGridGraph _graph = context.graph as LayerGridGraph;
for (int i = 0; i < _nodePositions.Length; i++)
{
var _nodeInt3
= _graph.GetNode(
(int)_nodePositions[i].x,
(int)_nodePositions[i].z,
0);
if (_nodeInt3 != null)
{
if (_nodeInt3.position.y < minimumHeight)
_nodeWalkability[i] = false;
}
}
}
But layers seem to always be 0 in any Pass
except in Pass.AfterApplied
, so I can’t really check above or below a node.
Thanks