Calculate Direction On Spheric World

Hi everybody,
I’m creating a space game with small planets. To calculate the movement direction to use in my BlendSpace 2D I used “Calculate Direction” in the Animation Blueprint (Actor velocity → Velocity | Actor Rotation → Base Rotation). The problem is that it seems to get confused when I move around the planet, resulting in situations where the pawn moves forward with the back walking animation. How do I properly calculate the direction movement on a round planet according to the real direction of my pawn (forward = 0, backwards = 180/-180, right = 90, left = -90)?

Thanks.