making a standing npc rotate

I am using the raycast extension and was wondering how I would be able to make a standing NPC rotate depending on what way you are looking at him, any tips?