x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Control light intensity with controller?

Hey there I am fairly new to UE4 but having a great time so far! Could someone please lend me your knowledge for a second?

I would like to turn the intensity (brightness) of a light up and down while in-game with my controller. Any buttons will do!

Any help would be great! Cheers!

Cam

Product Version: Not Selected
Tags:
more ▼

asked Apr 05 '15 at 11:47 AM in Blueprint Scripting

avatar image

CamRule
1 2 3 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

6 answers: sort voted first

You can cast to the light and control pretty much any element. There's two ways to do it.

Create an object variable in your player BP with the class if your light. So you'd use Point Light or Directional Light or whatever for its type. Select the light in your level and right click in the level BP. Create Reference. On Begin Play in the level BP, cast to your character and use Get Player Pawn for the input. From the cast, drag out and set the light variable in your player BP. For the input on setting that variable, plug in that reference you created for that light. You now have direct access in your player BP over the details of that particular light at any time.

Second method takes place entirely in your player BP. Use Get All Actors of Class and select your light type there. You'll use Get from that and set the integer value to whatever corresponds with that particular light. If there's only 1, it'll be set to 0. You then cast to the light type with that result, drag out the output of the cast, and do Promote to Variable. You now have direct access to that light.

Up to you what you use. It probably just depends on how many lights of the same type are in the level.

Once you have that reference in your player BP, you can use whatever input event you like and use that variable to control elements of it.

I can do pics later if you need them. Lemme know if this is what you were looking for

more ▼

answered Apr 05 '15 at 03:32 PM

avatar image

DG Gage
1.6k 62 31 129

avatar image CamRule Apr 05 '15 at 08:12 PM

hey thanks for the speedy reply! I am new to unreal and this sounds great, but I would probably have trouble building it just from words, could you please give me some pics or maybe even a small project file to work from?

Really appreciate your reply as I am super excited getting this to work!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Hi CamRule,

this is a different way to do it in the level blueprint: alt text

alt text

By adding a timeline, you can dim the light from its actual value, wich you need to set as first key and zero, the flipflop switches between the a and b output and tells the timeline to play or reverse. Setintensity finaly sets the actual value until the timeline stops. Let me know if something unclear. :)

input.png (193.8 kB)
dim_execute.png (355.3 kB)
more ▼

answered Apr 05 '15 at 04:18 PM

avatar image

showpixel
144 12 17 45

avatar image CamRule Apr 05 '15 at 08:14 PM

Hey there, thanks for going out of your way to give me another example!

I understand that I am triggering an animation timeline back and forth here, so the next step is to create the animation of the light getting brighter and to the end of the timeline. How would I go about doing this? Thanks so much for the input and screenshots!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Hi CamRule,

you can add a node by rightclicking into the blueprint, then search in the contextmenue for "add timeline", alt text once its in the blueprint, double click it and add one float track alt text in the timeline and name it to lightintensity. alt text

Then you can decide the length of the timeline and by shift+leftclick you add a keyframe. Do it at the beginning, set the value to the actual intensity value of the light and adsd another keyframe at the end , set its value to 0. alt text Select the keyframes and rightclick to change its interpolation from linear to auto to have a smooth fade.

Get back to the tab of your blueprint, you will see a new connector connect everything like in this picture and it should work.

alt text

01.png (30.1 kB)
03.png (26.9 kB)
04.png (32.4 kB)
05.png (33.6 kB)
13.png (84.0 kB)
more ▼

answered Apr 06 '15 at 11:18 AM

avatar image

showpixel
144 12 17 45

avatar image CamRule Apr 06 '15 at 11:33 AM

Hey thank you for the in depth answer! I will be working on this tomorrow, thanks again I look forward to getting this to work on my own project!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Hey there, thank you I got it to work! But! I want to press and hold to change intensity, but when I let go of the button I want the light to stop at the current intensity. Also I would like one button to play it forward, and one button to play it backwards, both being able to stop when I let go of the button. Can you help me please?

more ▼

answered Apr 07 '15 at 10:32 AM

avatar image

CamRule
1 2 3 5

avatar image CamRule Apr 07 '15 at 11:06 AM

I got it to work by removing the flip flop and just connecting one button to play and the other to rewind, both also to stop when release so they do not continue after releasing a button

avatar image DG Gage Apr 07 '15 at 12:53 PM

Good job :) your world of developing mechanics in BPs just opened up quite a bit

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

I have one Button on Widget , when i taget on Button , I want play time line in Actor ???? , Help me

more ▼

answered May 11 '18 at 08:43 AM

avatar image

MatHoDo
1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

I have one Button on Widget , when i taget on Button , I want play time line in Actor ???? , Help me

more ▼

answered May 11 '18 at 08:43 AM

avatar image

MatHoDo
1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question