Hello,
I’m making a game(obviously) where i want to play an animation(ping pong) whenever i can see the flare of my directional light. It is an animation where the player’s hand goes up to block the sun.
I hope that someone can help
Hello,
I’m making a game(obviously) where i want to play an animation(ping pong) whenever i can see the flare of my directional light. It is an animation where the player’s hand goes up to block the sun.
I hope that someone can help
A raycast would not do you any good, because even if the sun can shine on your player, it still does not mean the player is looking into it.
Also checking if the light is being rendered will not help, because if that light is casting a shadow you can see, it is counter as being rendered, and it will also cast shadows in the ground you could be looking at.
Add a other gameObject on the location of the sun, but make it not block the light ofcourse. And get a script to check if that object is visible (Unity - Scripting API: Renderer.isVisible).
If it is, you are looking into it.