- A* version: 5.3.7
- Unity version: 6000.0.23f1
Hello,
I have a LayerGridGraph with a custom rule. No colliders are involved and I pull my placement data from a separate class:
public override void Register(GridGraphRules rules)
{
this._grid = this.gridHolder.GetComponent<Grid>();
if (this._grid == null)
Debug.LogError("GridHolder does not have a Grid component.", this.gridHolder);
// Register this rule with the grid graph
rules.AddMainThreadPass(Pass.BeforeCollision, this._EvaluateWalkability);
}
private void _EvaluateWalkability(GridGraphRules.Context context)
{
if (EntityNavGrid.instance == null)
return;
var _nodes = context.data.nodes.positions;
var _walkability = context.data.nodes.walkable;
for (int i = 0; i < _nodes.Length; i++)
{
Vector3Int _gridPosition = this._grid.WorldToCell(_nodes[i]);
_walkability[i] = EntityNavGrid.instance.IsWalkable(_gridPosition);
_walkability[i] = true; // only for demonstration
}
}
But it won’t evaluate possible nodes from another layer (ie. y != grid center), so the data is always stuck on the ground. I have AstarPath.active.UpdateGraphs(_bounds);
where _bounds
are the world-space bounds of the (floating) blocks.
Am I missing something here? Thanks!