i have a black ghost and i want it move perfect in tiles square (54x54 pixel) to the green square, i use pathfinding but i dont really understand how this virtual grid work
The pathfinder works by using a grid. I drew the dots to represent the nodes. When you want a grid based like movement, you can set the pathfinder to the same size as the scene’s grid and set the offset to half the value.
This puts the nodes in the center of each tile. Make sure the object’s origin is in the center. It’s up to you if you want to disable diagonal movement. It’s under advanced.
hi, thanks Mr.Keith, it work kinda well, i set the grid width is 10 and grid high is 5, but can you help me explain what is x,y offset mean in pathfinding please
and my last question can i have method that make another ghost chose another way to green square, i mean another ghost not pick leftside, like it should pick frontside or rightside or below side not same leftside of first ghost
thanks for reply Mr.Keith
The offset moves the grid. If the spacing is 10x10 then the nodes would be at 0,10,20 etc. With an offset of 5 then it would be 5,15,25 etc. It uses the nodes to plan a path and avoid obstacles.
The pathfinder will always take the shortest path. The way to take a different path would be to either start from a different side or target a different position like x +10,y or place an obstacle.
I’m not sure how the obstacle part would work but the pathfinder uses the obstacles that have their behaviors enabled. You could move the one without obstacles and then place and enable a hidden obstacle.
hm… i see,i also test obstacle but seem it not work correctly, i think i should make opacity obstacle when first ghost reach and the second ghost must find another way, hm… that is my plan until now, let me test and tell you later