Having something change direction by following the mouse

how is it that you get something like say a gun which is stuck in one spot to change direction according to the mouse?