How to make an npc/ai walk next to the player? (C#)

Hello, I’m trying to get an NPC to walk beside the character as shown here. Currently, the NPC will walk towards the player while the distance between it and the player is greater than 2m. The NPC will then rotate to face the same way as the player (as shown here)

The code for the dog is here (I tried pasting it into this post but it came out weird)

I’ve been trying to find tutorials on how to do it, but the ones that I’d found didn’t make the NPC do what I wanted. If you have any pointers on what I should be doing or feedback on the code above, I would greatly appreciate it :smiley:

Edit - 07/11/16
I haven’t tried it yet but my theory for the solution would be to create an empty object, as a child of the character object, then offset it to the right/left side of the character. Instead of having the NPC make its way to the character it would instead go towards the empty object.

if you haven’t figured this one out yet, have you tried doing something like:

transform.position.x = (target.transform.position.x + distance);

and just execute that once the follower has moved to the desired position or you could even change the lookat to that position once the npc is close enough and then once it reaches that position hold it there.