the position of the widget on the screen depending on the object

Hello everyone, tell me how to make a similar thing, as in the screenshot? I mean the rotation of the widget element depending on the location of the object. Thanks
123