How to keep a MC a certain distance from the mouse cursor regardless of angle?

How to keep a MC a certain distance from the mouse cursor regardless of angle?

Can anyone provide me some code? I tried Googling but no luck. :frowning: