Closed meetpatel1989 closed 3 years ago
dir
, to 8
, to allow path finder checks Left-down/Down-right/Right-up/Up-left direction.pathMode
.@rexrainbow Thanks for the details it helped a lot! One last howTo question in the list. The plugin returns the shortest path from getPath but what if I want to move to destination from another path? For example, consider the orange arrow from the image I shared. Is there any option in which I can tell to find the path which includes a particular cell/node?
One more thing is, I checked the draw path demo. I noticed that path gets changed when I select the next block even if the cost of moving to a destination block is the same that is 4 blocks.
Please check the drawn path in the above image.
The new path should follow the 1st image path and should add the new block at the end but instead of that it creates a whole new path and changed the 3rd number block. I just wanted to know how the logic works here. Both paths have the same number of blocks to move then why does it gets changed? Is there a way I can stop this behavior?
Is there any option in which I can tell to find the path which includes a particular cell/node?
No option for this use-case. You can divide path into multiple segments, find path along these segments.
The new path should follow the 1st image path and should add the new block at the end but instead of that it creates a whole new path and changed the 3rd number block. I just wanted to know how the logic works here. Both paths have the same number of blocks to move then why does it gets changed? Is there a way I can stop this behavior?
In this demo, pathMode is set to 'A*'
, which is a faster way to find a path, but the result path might not be shortest, because that A* mode did not search all possible paths. You might try to set pathMode to 'straight'
, to get shortest path. BTW, the result path is reversed from end tile to start tile.
@rexrainbow Thanks for the help :). Can I use texture instead of shape for chess objects?
Is there any option in which I can tell to find the path which includes a particular cell/node?
No option for this use-case. You can divide path into multiple segments, find path along these segments.
How should I divide the path into multiple segments? I couldn't able to figure it out.
For example, from tileA to tileC, and tileB is the particular tile which has to include into path, then you can find path tileA -> tileB, and tileB -> tileC.
Is it possible to find the path from A to B and B to C without moving the game object? Path finder's findPath or getPath takes only endtile as a parameter and assumes the game object is on the start tile. I want to know the path without moving the game object.
Thank you so much for your help. :)
Try moveChess
method, set chess to tileB, then find path from tileB to tileC. Finally, move chess to tileA back, using MoveTo behavior to move chess along path.
Yes but for that, I have to move the chess to tileB. I want to show the new alternate path without moving the chess to tileB. The chess will move from A to B and B to C when the button is clicked.
Hope this will help to understand my point.
PathFinder supports occupiedTest
and blockerTest
, which means that user has to put a chess at a (tileX, tileY, tileZ) first.
To keep the character chess during path-finding stage, you might try to use another ghost chess only for path-finding.
BTW, set parameter align
to false
in moveChess method, can move chess in board's logic position, without change position in game world.
It worked! Thank you for the help.
I have a couple of questions that I couldn't able to find from the documentation.
1) How can I move a chess object diagonally in the quad grid? I tried to set pathMode to 'diagonal' but still, the object moves to destination using vertical & horizontal path only. 2) Is it possible to get all the possible paths if I know the destination cell? 3) Can I move the chess to the destination by giving my own path?
For reference, please check the following image.