Hi all,
I’m looking for a way to have colors 3 values (R,G,B) of a spot light. I would be happy to find a “Get Light Color”, or something like that in the LevelBP…
Is it possible?
Sure it is
https://www.youtube.com/watch?v=bqfHKmQ6VXU
I think I don’t explain my request correctly.
What I would, is to use a variable in the LevelBP with the current value of the linear color of a spot light.
For example, something like the “Get World Location” wich give the 3 axis values, but here it’s for the 3 “R, G, B” values.
I hope to be clear, sorry for my english…
No problem.
Just do like the guy in the video. But to have it in the level script, you need to add the following:
- A function in the light BP that takes a vector parameter. The function sets that as light color.
- From the levelscript you can then access your light actor in the scene and call the function with any values you like.
Drag “GetLightComponent” from Light reference in Level Blueprint and then drag from it “GetLightColor”. Then you can right click and split node into R,G,B,A values
Can you explain a little bit more? Or maybe you have an example…
Hmmm. I could make one…
Ok. Here we go:
Just made this really quick and dirty:
-
Create a BP with a light component. I have chosen a spotlight. Dont forget to set your light to stationary or mobile, but not static.
Also add a variable for a default color:
-
Create a function that sets the light color based on a input parameter:
-
Call the function in the construction script to provide a default value for the light.
In the editor, it looks like this:
(Note that you can convientiently change the default color in the details panel)
- In the levelscript, add a color variable. Then you can assign that value to any lightBP actor by calling the function (the same way you did in the construction script)
Of course you can call it whenever your gamelogic requires it. This should just show you the general direction.
Hope that helps.
Cheers,
Klaus