Hi guys, I'm trying to build a level scanner that can detect collisions and create a grid avoiding that collision. I can easily build the grid but the script doesn't remove the nodes "blocked" by something. All I get from Debug is Scanner is true(0.0, 0.0, 0.0). . . Here is the code:
public static void BuildGrid(Vector3 position, int numX, int numY, int spacing)
{
List nodes = new List();
int count = numX * numY;
for (int i=0; i 0)
node.BiDiConnect(nodes[i-1]);
if(y > 0)
node.BiDiConnect(nodes[i- numX]);
if(x >0 && y >0)
node.BiDiConnect(nodes[i-numX-1]);
if(x < numX -1 && y >0)
node.BiDiConnect(nodes[i-numX+1]);
if(scanner)
{
node.Delete();
Debug.Log("Scanner is true" + node.Position)
}
}
}
↧