- Home /
How to tell I am looking at the sky/skybox
I am trying to get my camera to recognise that it is looking at the sky to then display some text. I have tried to verify that it is looking at the color blue.. that it is looking above the horizon.. things like that problem is as far as i know that the skybox is not an object so i cant just confirm that it is there..
Answer by YoungDeveloper · Aug 11, 2013 at 11:32 PM
You could create big box colliders above the ground and tag them "sky". And then use raycasting(from player view) to check if you are looking at the sky.
Answer by Joyrider · Aug 11, 2013 at 11:27 PM
Depends what you are trying to achieve exactly and how your scene is built.
If your environment has colliders, you could use a raycast, and if nothing was hit assume you are looking at the sky.
To limit performance hit, you could also
compare your camera's forward vector with the world's Y-axis, to know how high up or down you are looking.
And check for the sky only when you are looking above a given (Y)up-value (0 being the horizon).
Your answer
