Hi there! I would like to know how to spawn NPC’s in dark, so for example if i put light in some place, NPC’s will spawn anywhere, except for lighted spot. Kind of like in Minecraft
Not 100% sure just thinking about it right now, would there be any way you could like check the distance of the light to where the spawner is or if it’s random check if where it is gonna spawn if there is a light near it via distance.
I’d do it by looping through different spots in the map, running a function that checks whether the spot is in darkness by raycasting to all lights in the map as well as straight up (to check whether it is in sunlight). If the spot is in range of any light, or is lit up by global illumination, spawn the NPC