Announcement

Collapse
No announcement yet.

Dimmable Light according to Distance of character

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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....

    Click image for larger version

Name:	Light.JPG
Views:	1
Size:	121.7 KB
ID:	1155642

    Click image for larger version

Name:	Light2.JPG
Views:	1
Size:	44.3 KB
ID:	1155643

    Thanks for any help in advanced!

    Regards,
    Seichi

    #2
    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...

    Click image for larger version

Name:	Light3.JPG
Views:	1
Size:	92.5 KB
ID:	1081755

    How can I create a minimum and maximum range? The "Value Range" in the "Distance" variable is not working... :/ any ideas?

    Comment


      #3
      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.

      Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	143.8 KB
ID:	1081759
      Last edited by quality; 07-15-2015, 10:33 AM.
      CTO Villusion Studios
      Grad Student in Interactive Design and Game Development, SCAD
      company site: http://www.villusionstudios.com/

      Comment


        #4
        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?

        Regards,
        Seichi

        Comment


          #5
          Here's a video Seichi that should explain better than I could in words:



          cheers!
          CTO Villusion Studios
          Grad Student in Interactive Design and Game Development, SCAD
          company site: http://www.villusionstudios.com/

          Comment


            #6
            Hi quality!

            Thanks for making the video! It was super clear
            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?

            Comment


              #7
              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:


              Attached Files
              CTO Villusion Studios
              Grad Student in Interactive Design and Game Development, SCAD
              company site: http://www.villusionstudios.com/

              Comment


                #8
                Hey Quality!
                Thanks for the reply! Ill try that

                Comment

                Working...
                X