Getting camera angle if the person does not look at the avatar and do something

friends , i am completely new to unity/VR and trying to build a simple VR project for my son. What i need is , when a person (who wears the HMD) is not looking at an avatar then avatar will ask the person to look at.
the way i am thinking is , if the camera angle is more than 30 degree from the center of the avatar , which could be LEFT OR RIGHT OR ABOVE OR BELOW , then avatar will say ‘look at me’
i know this is simple for you experts ,i googled it to see if there is any piece of code that could help me but i was confused at the end as different people are using different packages.
Friends … please validate if my approach (>30 degree) to find out if the camera is away from the avatar is correct or not , if you think this can be resolved differently then let me know .
Also a sample code which will do the above requirement.
Thanks in advance …

One solution could be to use Vector3.Angle() to compare both direction from the headset and the object to look at:

Vector3.Angle(headset.transform.forward, objectToLookAt.transform.forward);

Should gives you the float angle between both of them.

I think this thread is what you are looking for in case it’s not working
https://forum.unity.com/threads/check-if-two-directions-are-similar.1052414/

Thanks Nicolqs, appreciated, let me try to undestand it :slight_smile: and then try it out .