Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | noobGuy | |
Old Version | Published before Godot 3 was released. |
Hi guys,
Here’s my problem, I use a directional light to simulate the sun in my game.
It works well a simple pi rotation along x axis allows me to simulate the sun path from sunrise to sunset, and it creates shadows accordingly to the sun position (= rotation as i use a directional light as i said previously).
Now how can i detect if a tile of the ground is in shadow or enlightened ?
My first idea would be to ask the directional light (but i don’t know how to do it…)
My 2nd idea would be to cast a ray (which sounds useless to me as the directional light must have already performed a ray cast to produce light (and therefore shadows)). Whatever, if the way to go is to (re)cast such a ray, what would be the “from point” ?
I can’t just take a random distance from the scene, as obviously the light and shadows depends on the distance from the directional light to the scene, meanwhile the doc describes a directional light as a light far from the scene… but far ain’t a distance i can use as a “from point” far a raycast
Help me please, i’m so lost here XD
Ty for your time guys