Path Finding
by Tim Tebow · in Torque Game Builder · 03/25/2009 (5:47 pm) · 5 replies
Hey all quick question.
I am trying to basically create a replica of the aStarDemo that comes with TGB and running into a issue.
I changed a few things for example instead of it calling the function spawnRandom(objectnamehere) I manually put it into the console I can control it.
Everything works up to the time I get this ->
PathAStar2d::calculate( sX / sY, dX / dY ) - start or end points are not on the grid
Few of the other things just to spice it up that I changed was I placed 5 boulders in the middle of the map and put a chest on the 1 side of them and the on the opposite side I put a ship. So what im wanting is the ship to figure out what path he needs to take to get around the boulders to the chest.
If there is anything I can post to allow you to help me please tell.
I am trying to basically create a replica of the aStarDemo that comes with TGB and running into a issue.
I changed a few things for example instead of it calling the function spawnRandom(objectnamehere) I manually put it into the console I can control it.
Everything works up to the time I get this ->
PathAStar2d::calculate( sX / sY, dX / dY ) - start or end points are not on the grid
Few of the other things just to spice it up that I changed was I placed 5 boulders in the middle of the map and put a chest on the 1 side of them and the on the opposite side I put a ship. So what im wanting is the ship to figure out what path he needs to take to get around the boulders to the chest.
If there is anything I can post to allow you to help me please tell.
About the author
#2
03/27/2009 (4:46 pm)
I got it figured out and so far so good so if anyone has issues please ask and I can tell you what I did.
#3
05/11/2009 (5:53 am)
Would you mind sharing your solution :D
#4
I'm having a hard time determining where, spatially, and hierarchically, the pathgrid is placed and why it is complaining about this "PathAStar2d::calculate( sX / sY, dX / dY ) start or end points are not on the grid".
What I have done is to first render the visual game world with my own tile/array system, rather than using a tile layer/tile map. I supposed the pathgrid would work fine as long as I put weights in it and it was identical in size and position to the visual rendering of the tiles, although the tiles have nothing to do with the layer/map.
03/23/2010 (1:42 pm)
Hum, yes I have run into this issue as well. I'm creating a tilemap and then a tile layer within the code, since my game is procedurally generated instead of designed with the editor - which I suspect is a problem (it usually seems that way with tile maps/layers). I'm having a hard time determining where, spatially, and hierarchically, the pathgrid is placed and why it is complaining about this "PathAStar2d::calculate( sX / sY, dX / dY ) start or end points are not on the grid".
What I have done is to first render the visual game world with my own tile/array system, rather than using a tile layer/tile map. I supposed the pathgrid would work fine as long as I put weights in it and it was identical in size and position to the visual rendering of the tiles, although the tiles have nothing to do with the layer/map.
#5
03/23/2010 (2:08 pm)
It might just help to narrow the question down to this: Is a tilemap required for the astar pathgrid to function happily with the tilelayer?
Torque Owner Tim Tebow
function aStarActor::findDestinationPath(%this, %destination)
{
//THIS LINE BELOW HERE I tried doing it like it is below and
//%this.getPosition(), %destination but neither ways work
%newPath = %this.pathGrid.createPath("-21.913 21.474", "-2.120 -3.723", false, true);
return %newPath;
}
Any ideas?