Hey,
I'm having some problem using c_scan with my pathfinding project. I need to scan in a node (it's A* based), and I'm creating bitmaps to see where the nodes are. But unfortunatly these get scanned as entity's too, so it can't find a free path (without entity's). How do I solve this, because it doesn't detect the other entity's too
Here's the code:
Code:
void CalcUsableNodes()
{
var i;
var j;
for(i=0; i<gridWidth; i++) //loop through width nodes
{
for(j=0; j<gridHeight; j++) //loop through height nodes
{
tmpModel = ent_create("under.bmp",vector((j*64)+32,(i*64)+32,5),NULL);//create a bitmap to see where the node is
Snap(tmpModel); //make sure it's in the right position
var scanResult = c_scan(vector((j*64)+32,(i*64)+32,1),tmpModel.pan,vector(360,0,32),SCAN_ENTS|IGNORE_ME); //scan for ents
if(scanResult == 0) //if no entity is found
{
nodes[(i*gridWidth)+j] = 1; //this node is clear for walking
}
}
}
}
Unfortunately all of the nodes stay on 0 (their initial value). Maybe there is a problem with the c_scan?
Thanx,
b-studio