Any way to check what the light/shadow value is at a point on the terrain? Alternately is there a way to have raycasts from a directional light (Sun) HIT terrain trees?
Nevermind, I solved it by putting a plane in the tree near top and removing the renderer. This way the sunlight does not hit the player (well the raycast anyway) so I can tell they are hidden in the trees.
OK actually that doesn’t work (used a cube collider) - they don’t propogate to the trees when they are painted in the actual game. Not sure why not as my capsule collider does.
Is anyone else doing shadow detection for stealth (outside) ? Other light sources are not an issue, just having issues with the terrain trees and have the suns raycast not be blocked (or other ways to detect a hidden character).
Wow one way conversation =) Hopefully someone might find this of some use at some time. Anyway what I ended up doing for stealth is I simply check how close to the nearest tree I am and depending on its prototype index I figure out if the character is underneath the tree (in cover). This works well and does not seem to be CPU intensive (and I have 14,000+ trees).