Dimmable Light according to Distance of character

Hi everyone,

I’m trying to set a “stationary” light source to turn on (Visibility: on Intensity: 0) as soon as the player steps into the trigger box and the intensity slowly grow as he grows closer to the light source.
So far I have tried doing a variable that depends on the distance between the character and the light source. This variable called “distance” is then substracted 1200 (half the distance of the trigger box so that it starts at 0) and then multiplied by 3 or 4 so that the end intensity would be 4800.

The problem lies that the light only turns on at the end intensity and doesnt scale up or down as I move towards or away from it. I also wonder if there is a way I can set a maximum number allowed so that I could cap the intensity growth midway to the light source as I would like to give the player an area around the light that would allow them to move around without the light jumping up or down.

Here is what I have come up with but is not working…


Thanks for any help in advanced!


Ok, I figured it out…
Instead of Get Player Actor I used a reference of the character and made sure that the distance would start in the negatives (* -1) and then add the 1200 so that It is always below 0 when outside of the bounding box… :slight_smile:

How can I create a minimum and maximum range? The “Value Range” in the “Distance” variable is not working… :confused: any ideas?

I did something very similar to this just yesterday. I didn’t do it exactly the same as you are but it might help you to look at this setup. Ignore the comments above the nodes. I was using this to change FOV based on distance.

So in the graph below the vector length node would be your distance variable. You then use the “Normalize to Range” node to normalize your distance to a zero to one value over a specific distance. The Range min would be your close value, and the range max your far away value. These are Unreal units. Then you feed the return into a Lerp which will transition between the two values for your light intensity. So A would be your maximum intensity and B would be your minimum. Then feed this into a “set” to set the variable just like you already have. I can further explain if this is confusing.

Hi quality,
how did you get the vector? how can i set the origin points of my character and of the light as the points to draw the vector? do you know?
im also not sure how Lerp works… if you already had the range, why need that?


Here’s a video Seichi that should explain better than I could in words:


Hi quality!

Thanks for making the video! It was super clear :smiley:
I think your method is the correct way of doing it… mine works but it seems to have too many steps.

Thanks again for the video!

do you by any chance know how can I trigger lights to dim on and off using time cycles? :slight_smile:

Look into using timelines or a timer node. Either one will allow you to control when something happens based on a specific time. If you are looking for a flickering effect or something of that nature a simple timeline that loops over a number of seconds should be all you need. I threw this together hastily but it should give you an idea:



Hey Quality!
Thanks for the reply! Ill try that :slight_smile: