Hello all…
i am working on implementing parallax concept in my game …
I want to get name of all the objects rendered by main camera…
so that when camera is not rendered to object then i can shift its position forward…
Thanks
Hello all…
i am working on implementing parallax concept in my game …
I want to get name of all the objects rendered by main camera…
so that when camera is not rendered to object then i can shift its position forward…
Thanks
Also look up OnBecameInvisible () …
If you have more than one camera in your scene then the visible or not approach may be buggy.
If it is Orthographic Camera as Main camera you could also attach a Cube Collider (make it child of Cam) to your Main Camera… make it the exact size of the Ortho view, then try doing a function OnTriggerExit() check … although that may be too complex and I think checking visibility is the better option?
hi… Thanks for your reply…
i make experiment with OnBecameInvisible() but it doesn’t work i write a script …
and attach to Object when camera is not rendering to this object then it will shift 10 units forward but it doesn’t work
I think in the Editor view is also considered a Camera and if you can see it in Editor Window then it is still Visible … try to Publish it and test it… also add a
So you will know for sure rather than rely on just transform.position …
Both
function OnBecameVisible() and rendered.visible returns the name of object on which script is attached …
but i want that if moving camera is looking at object then the object name is displayed not all object names on which script is attached
Can you attach ScreenCapture or diagram? I dont understand what you are trying to do.
“Camera is looking at object” in Unity means anything that is in the Camera view, near or far, so EVERY gameobject in view will show their name … but if you want to do Ray casting from Camera into the World then check if the gameobject is hit… then return name of that gameobject.