How can I make an artificial intelligence that follows the main actor, but does not rotate by following it?

I try to create a 2.5D video game (2D characters that can move x, y, z) My problem is that you create an enemy, but this rotates your body when moving in depth, can this block?
PS: my native language is Spanish, forgive if something is not completely written