How can I check if a node in my scene graph is actually seen by my main camera?
In my particular use-case, I want to know if a node is (in the area) behind the camera.
Thanks.
How can I check if a node in my scene graph is actually seen by my main camera?
In my particular use-case, I want to know if a node is (in the area) behind the camera.
Thanks.
You only need to know 3 things to do this: the view direction, the position of the camera and the position of the node (all in the same coordinate system).
Then the test is easy:
dot(view, nodePos-cameraPos)<0
wheredot(v1, v2)
is the dot product of 2 vectors in other wordsv1.x*v2.x + v1.y*v2.y + v1.z*v2.z
.