- Home /
I posted on the Aron Granberg forums, and got an answer: http://forum.arongranberg.com/t/how-to-minimize-directional-changes/4238/3
How to minimize directional changes of A* autopathing movement?
Hi,
I followed this tutorial here to make my characters move using A* algorithms here: http://hobblygobbly.tumblr.com/post/93960257057/how-to-setup-the-a-pathfinding-project-in-a-2d
The autopathing works great, and the characters move wherever I click on the screen. However, when i added directional sprite changes, the paths are often generated in a way such that the character rapidly changes between two adjacent directions. How can I fix this so that the A* algorithm generates an optimal enough path to the destination while making as few directional changes as possible?
Here is a screenshot of a generated path: http://imgur.com/a/OAE8c
As you can see, the path has a large number of directional changes, causing the sprite to constantly change. The node size is set to 0.16 (16 pixels by 16 pixels), and the smaller the node size is, the more directional changes that occur. I'd like to keep the node size as small as possible to make the movement of the characters more precise, but by doing so I sacrifice the aesthetics of the gameplay. Please help me fix this. Thank you!
If you need more information, I'll do my best to give more.
Follow this Question
Related Questions
Is there a way for me to find the walkable edges of my traversable game map? 0 Answers
Problem with calculated path of a NavMeshAgent 0 Answers
A* Pathfinding, destroying a path once it has reached its end 0 Answers
Find the closest point of an Invalid or Partial path 0 Answers
Delete Astar Path gride graph around a particular Object 1 Answer