Heya, I am currently working on an enemy that follows the player using the pathfinding behaviour. However, the enemy isn’t changing it’s animation properly depending on the direction it is moving in. How do I get it to change its animation according to the direction? (look at first image below) I’ve also provided code for how i previously attempted to get this to work. Thanks!
I like the 2nd method. Since the angle goes from 0 to 360, the right direction is going to be from 360 - half of the variance to 0 plus half of the variance. You could use 0 with a variance of say 75 and 360 with a variance of 75 which would give you a combined variance of 150 or you could use the compare 2 numbers condition. That would be 285 to 75 degrees.
The variance is up to you. Just remember there are 360° in a circle. The variance is in both directions. (+ and -) So, a variance of 75 is really 150.
150+150+30+30 = 360
1 Like
Thank you so much! I tweaked the variances a little bit, And it looks great! Thank you!!
2 Likes





