Watch the video here π
Video Description
In this video we see a solution that could be used to recreate the movement of the Sovngarde statues of Skyrim, those statues that when the player is not looking at them turn towards him. The solution that I bring you can detect if the camera is looking at a certain object or not, this allows us to make certain scripts execute instructions only if they are OFF-CAMERA or only if the camera is looking at them. In addition this solution has two functions that are called only once when the camera starts looking at the object or stops looking at it.
YT does not allow inequality symbols so here is a link to the instructions:
instructions here
And while we are at it I leave you the script I made in the video:
download the script here
You can assign it directly to a GameObject, configure the necessary in the inspector and it should work.
TIMESTAMP
0:00 – What are we going to do?
0:44 – Prototype made from this solution
1:35 – How to configure the solution. Initial conditions
1:54 – Creating the Script and adding the instructions
3:10 – Setup in the inspector
4:21 – Test run
5:18 – Functions to enter custom code