Amerio.Stephane Posted June 5, 2025 Posted June 5, 2025 Hello, I use AutomaticTimeLightingComponent to control the state of lights and emissiove materials in our scenes. But the option to control nodes on/off for day and night only work for nodes readily accessible in the scene by name; it doesn't work if the node is deep inside a NodeReference inside an entity for example. As an example, I need to control the lights (projectors, etc) inside the cabin of an aircraft. I tried to replicate the behavior of this node in a custom component but couldn't rewrite its logic (how does it know it's night time?) - Can you help me write such a component logic? - Could AutomaticTimeLightingComponent be extended in the future for this kind of use case?
cash-metall Posted June 6, 2025 Posted June 6, 2025 Hello! AutomaticTimeLighting works together with the LightSourceComponent. Assign a LightSourceComponent to the node that needs to be turned on/off. Specify a category for it, such as test/NIGHT and test/DAY. Then, add an AutomaticTimeLightingComponent to the scene and configure it with: Control Type = celestial or time For the celestial mode, you need to set the zenith angle at which day/night will be determined. For the time mode, you need to specify sunrise and sunset times. Next, in the Categories Day Enabled section, specify the test/DAY category, and in the Categories Night Enabled section, specify test/NIGHT. you can also place such nodes inside a Entity NodeReference and they should work correctly inside it. After that, you can run the scene and see how it works. (see attached video) you can also controll LightSourceComponent using console command lights <cat> 1/0 or via API ig_manager->getLightController()->setEnabled("test/DAY", 1); 2025-06-06 15-22-26.mp4
Amerio.Stephane Posted June 6, 2025 Author Posted June 6, 2025 Ooooh I didn't know about that Component! Nice to learn that! Also, I learn here a new console command (datetime), which is apparently not documented (or I missed it in the doc). Any other tricks under your sleeves? Thanks a lot!
Recommended Posts