I want to make an RPG with the ORK Framework. For accessibility reason, the player should be able to move with mouse and keyboard. So far everything works. I did setup a graph, the player moves and everything works. Except I need to restart the pathfinding in case the player moved with WASD.
This is not a problem because most people with either play with WASD or Mouse but I want to know how to fix it to better understand it.
Here he moved with mouse click to a location:
But after moving away from it for the A* Graph he is still considered to be at the location.
At this point If I move him again with a mouse click he moves first back to his old position and I have to click again to move him to the desired location. How could I change it so that he always calculates a path on mouse click from his current position?
I hope I described my problem well enough to be understandable.
Do you disable the agent while moving with WASD?
I’d recommend doing that.
I did disable the AIPath component. Maybe I made a mistake and I am currently using wrong components.
The Mouse Controller handles mouse inputs and the AIPath and Seeker components handle the movement. They are from the AstarPathfindingProject. While and after using the keyboard they are disabled and get enabled when the player uses the mouse again.
Should I use different components to move the character on the A* Grid?
Hey I am still facing this problem. I am sorry that I bump this topic so shamelessly but I hope someone can help me with my problem
That’s odd. As long as you make sure to enable the AIPath component before you set the
destination property (I’m assuming that’s what you are setting anyway), then this should work just as you want.
Would you mind showing the code you are using?
The code is part of the MousePlayerController. I think, this script is from the ORK Integration for A* Pathfinding, if you say that the A* Components are correct and the behaviour is not from A* then I probably have to ask in the ORK Forum.
Thanks for the Information.
Continuing the discussion from Restart Pathfinding from a different Point:
Hi, did you find any solutions to this? I am having the same issue.
If you move an agent while aiPath is disabled, the agent moves back to the original point when it is enabled…
This is a big issue for me and no one seems to have ideas.
If you find a way to work around it, please let me know!