How do I interact with objects with a cursor

How to make sure that when a character looks at a point a certain then an event occurs. For example, there is a mug, I approach it, look at it, make a cursor and after that there is some event?
Who could have done such a thing already? Do you have any ideas how to implement this?