A* Pathfinding Project

Face Player towards Path


#1

Hi there!

I’m developing an isometric 2D exploration game using this awesome pathfinding library :smiley:

In my case, I’m working with a grid graph in which I move the player around and I’m trying to animate the movement depending on where the player should face on each node of the path (the rotation of the seeker is disabled).

My doubt is… how do I get that info on each iteration of the path in order to animate properly my character? I’ve been looking at the documentation but haven’t found anything.

Thanks a lot for the help in advance!


#2

Hi

You can use the ai.velocity property to determine in which direction it is moving and set the animation based on that. Or you could use the ai.steeringTarget property which is the point the AI is currently trying to move towards (it may not do that at the moment due to e.g. local avoidance or other things however).