2D Top Down, get direction

I posted a question recently on how to turn off rotation. But I believe this should be it’s own question for future readers.
Before applying your pathfinding I used a simple Vector for direction, for example:

left: (-1, 0)
right: (1, 0)
up: (0, 1)
down: (0, -1)

This was then used to set the correct animation.
Any way I can get something similar from AIPath? basically:

 if (direction.x < 0f && direction.y == 0)
        {
            SetCurrentCharacterDirection(left);
        }

or something of that kind.

Hi

You can use

var direction = ai.velocity;

Or you might want to use the direction that the AI wants to move with (though it might be blocked for some reason).
This is possible in the 4.1 beta only.

var direction = ai.desiredVelocity;

See https://www.arongranberg.com/astar/documentation/dev_4_1_8_94c97625/iastarai.html#velocity

While waiting for an answer I found that I might be able to use ‘dir.normalized’ inside ‘MovementUpdate()’. It seems to correctly debug a value between -1 and 1.