Optional
algorithmOptional
closestcharId
will move to the closest point
(manhattan distance
in case of 4 direction mode and with and
Chebyshev distance
in case of 8 direction mode)
to charIdToFollow
that is reachable from charId
in case that there
does not exist a path between charId
and charIdToFollow
.
Optional
considerOnly considered by A* algorithm.
If set to true
, pathfinding will consider costs. Costs are set via tile
properties.
false
Optional
distanceMinimum distance to keep to charIdToFollow
in
manhattan distance
in case of 4 direction mode and with and
Chebyshev distance
in case of 8 direction mode.
Optional
facingThis setting is ignored if you provide a FollowOptions.distance other than 0.
An unblocked position adjacent to the target character with the shortest distance to the source character (the one following) is taken as a target. If there are multiple of these positions any one of them is picked. With this setting you can give an explicit position based on the current facing direction of the target character.
For Example:
If you provide a FollowOptions.facingDirection of 'down', that
means that you want to follow the position the character is turned away
from. So if the target character's facing direction is right
, that would
translate to this:
down-left | left | up-left
down | (=>) | up
down-right | right | up-right
Optional
ignoreIf set to true
, pathfinding will only be performed on the char layer of
the start position. If you don't use char layers, activating this setting
can improve pathfinding performance.
false
Optional
ignoredSet of characters to ignore at collision checking.
Optional
isFunction to specify whether a certain position is allowed for pathfinding. If the function returns false, the tile will be consindered as blocked.
It can be used to restrict pathfinding to specific regions.
Beware that this method can become a performance bottleneck easily. So be careful and keep it as efficient as possible. An asymptotic runtime complexity of O(1) is recommended.
Optional
maxIf this is set, the algorithm will stop once it reaches a path length of this value. This is useful to avoid running out of memory on large or infinite maps.
Algorithm to use for pathfinding.