AI Character stuck when building a block that is added to the grid graph


#1

Hello,

Thank you for the outstanding work on this asset, its much better than the glitchy unity nav mesh.

I have 2 issues actually:
(blue blocks are blueprint blocks which are going to be turned into normal wood blocks, they do have collider but do not have the:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Pathfinding;

public class UpdateNavObj : MonoBehaviour {
	
	Collider collider;
	// Use this for initialization
	void Start () {
		
	collider = GetComponent<BoxCollider>();
	Bounds b = collider.bounds;
	Pathfinding.GraphUpdateObject guo = new Pathfinding.GraphUpdateObject(b);
	//guo.setWalkability = true;	
	
	AstarPath.active.UpdateGraphs (guo);
	}

code that makes the block walkable when built, meaning the code above is attached when the block turns brown)

The issues:

  1. The grid extends itself onto the other blocks which should not be but will be updated to have a grid when built.
    When one block is built, it extends its grid to the other neighboring blocks.

Screenshot_9

  1. Which leads to the second problem - the character walks near or on top of the block (to go near another block, and when the character builds the block below it, the grid disappears

You can see dark blue area (the grid) is not connected from the side of the character from the terrain toward the upper part of the blocks where the character is standing.

Because of this it actually creates the green grid above the head of the character instead of the block.

Screenshot_8

I already set the “end reached destination” to 2f but until the grid expands to non built blocks, issue will persist.
The other solution would be to ignore the player while the grid is built there?


#2

Hi

You have your height testing layer mask configured incorrectly.
See this page for more info https://arongranberg.com/astar/docs/errormessages.html#no-open-points-start (under the heading “No open points, the start node didn’t open any nodes”).


#3

Thank you for the answer.

Now that this issue is cleared away, I noticed that if I keep building, the area at the bottom keeps disappearing, because when it updates the grid, it actually takes over the bottom part instead of adding a new node I guess.

I should use another graph instead of the grid graph that has the raycast detection from above? Or maybe I should create another grid graph that raycasts the cubes only and I just change the code to AstarPath.active.UpdateGraphs[1] (guo); while leaving the terrain grid graph alone?


#4

Hi

In the pro version there is a layered grid graph which supports multiple nodes in a single x,z cell. You might want to use that instead.