Light Switch System (Unreal Engine 5)
Since our Game Jam project is a horror based shooter set in a dark cathedral, I thought having lights that can be switched on and off would be a good idea. This could be used to highlight hidden areas or items.
First made a simple button to act as a switch and a sphere collision so we can turn the light on and off.
Next, is et up for the logic for switching the light on or off. I created a variable, for checking whether the light was on or off and set up an each loop. The branch checks whether the light is on or off and for testing purposes, displays a message whether the light is on or off. I added a spotlight into the scene and created a variable for the switch and one that accessed the spotlight component as a value. I set the intensity of the light to the desired value in the scene and set that to when the light switch is on. When the light switch is off, the light intensity is set to zero. In the image below, you can the default value of that spotlight is also set to zero, as it should be off, until triggered.
Comments
Post a Comment