Flip 2d character left/right

I need to flip a 2d character in a 3d world to look right/left dependent on the direction they move relative to the screen. So if they wander in a left direction relative to the screen it will flip to look left and vice e versa.

How do I define an objects position relative to the screen so I can tell if it moved in a left/right direction from it’s last ‘relative to screen position’?

Thanks for any help!

Assuming you have a standard 2D setup, just subtract the previous position of the object from the current position of the object. If the x of the resulting vector is negative, the movement is to the left. A positive value, and the object is moving to the right.