[SOLVED] Object with active pathfinder behavior can't move using other methods

Hi!

I’m creating a small game. When player tries to set up a wall, the game checks whether this wall will trap the player. This check is done using the Pathfinder -behavior (the official one).

Since I don’t actually want to move the player, I have set my acceleration and speed to be 0:

In the events, I “move” (with 0 speed) the player towards the goal using the pathfinder’s “move to a position” -action. I then check whether there is a valid path using the “path found” -condition.

The only reason I use the “move to position” at all is that – in my understanding – it’s necessary in order to use the “path found” -condition.

The problem is that after I do this, the player is completely unable to move. It’s like the pathfinder says: “I’m on my way to the goal and nothing will interfere until I’m there.”

This is how player moves:
image
This stops working.

De-activating the pathfinding behavior fixes the issue, but when I turn it back on after moving, the player immediately teleports back to the original position.

“Stop the action” -action doesn’t seem to fix the issue.

If path is found why don’t you try to disable pathfinding behavior?

As I said, deactivating it doesn’t remove the issue. When I reactivate it, problem persists.

Deactivating permanently isn’t an option. Every time a player adds a wall, another pathfinder check needs to be done.

If you’re using another method to move it then you need to clear the pathfinder path first . The Nav Mesh has a function to cancel a path. I can’t think of the actual name for the action. The offical pathfinder doesn’t. The easiest way is to move the object to the current location with the pathfinder move action.

Ok sorry my fault its there on the bottom i did not see it

And i think what is going on is in fact for engine even speed 0 is still trying to move
Think of it like this you cannot move with other means if you set speed to 100 but also if you set speed to 1 cause it is moving using pathfinding
Well whatever

Ok let’s do something stupid and take it into your heart
Never try to force your way trough the way you want to do it
But do it any way you can

Since pathfinding works
AFTER path is found why not just
1 - de activate pathfinding
2 - when you are activating pathfinding again set path to player position so he do not teleport back
3 - you can now set speed back to 0 and check if path to wherever you need is possible then repeat the process

There is condition called path reached or destination reached or or something like that

Hi. Thank you for all the suggestions.

Keith’s idea sounded good, but after switching to the Nav Mesh version of pathfinder, I couldn’t find any “cancel path” actions. Do they exists? Maybe I just didn’t look hard enough.

Zero’s idea didn’t work as it stands, but after some tweaking, I got it to work. I overwrote the original path with:
“move to player.X(); player.Y()”.
I never disable the behavior. It stays on the whole time.

I changed behavior settings so my acceleration is now 1000 and speed is 0. I don’t know whether this change had any effect. I never modify these values with events.

With this, everything works. Thanks again.

1 Like

Sorry about that. It’s the linked tools pathfinder that has a forget path action. It uses objects as nav points.
.

Setting the destination to the current position is the best way to cancel a path in the other pathfinder behaviors.

1 Like

You can also create a temporary object when you need to test the path and then delete it.

1 Like