I’m creating an dark environment and I want to make a platform light up when the character steps on it. Do you have to code that or can you use blueprint?
First thing You have to do is to create proper material that can emit light and could be controlled from blueprint.
Important thing is scalar parameter node (You can make one by clicking left mouse button while holding S). This is parameter that we can later change in blueprint (Set it to more than 0 so material will start to emit light). Important is to name it in details. I named it ‘brightness’.
Next create new actor, and add to it static mesh that will be Your platform, and collision box above it so we can detect when player come inside of it.
Now lets go to Event graph.
##Begin Play
In begin play we want to create dynamic instance of our material and save it to variable so we can edit it later. Easy way to create variable is to right click on return Value and select promote to variable
##Actor Begin and End Overlap
Those are two events that fires whenever something enters or leave our collision box. I’ve used Cast to DefaultPawn to see if thing that entered is unreal DefaultPawn that is used as player pawn in my project. You should cast to Your pawn here.
###Timeline
Timeline is a thing that make smooth “animation” of variable.To add it, right click and select add Timeline. Double click on it to edit it. Mine is looking like this below, so it will change brightness parameter inside material rom 0 to 1 in 2 seconds. To add new float track, click ‘f+’ button on the left. Remeber to check “Use Last Keyframe?”.
To create new keyframe, left mouse click while holding shift. Then You can set them values and time. first should be 0, 0. With second You can controll how much and how long light up will take.
To smooth time line, right click on keyframe and select auto.
It can appear to be a lot of things, but it less than one minute of work if You know all of this stuff.
You are a legend dude! I will definitely try this out tomorrow! Is there a possible way to contact you if it does not work for me?
Thanks for your help man! I was wondering if you could tell me how to make a platform move upwards as if it were an elevator once the character steps on it? Can you also explain how to add a bit of delay before the action occurs? Thanks heaps!
By the way how did you create that static mesh node for the create dynamic material instance, and Dynamic Material for Set Scalar Parameter Value? Sorry I’m still learning UE’s blueprint. Thanks again
I guess, You can just put a comment to ma answer to contact me
Hi. I had a little too much free time so I’'ve made a video tutorial how to do it. I don’t know why but voice quality sucks. My microphone started acting weird, but when I’ve restarted a computer, it went back to crystal clear voice… Weird.
Here is a link to playlist
PS: You can click Up arrow on left from my answer to show that I’ve helped.
You are a legend Mr dzarafata! Thank you for your help!!!
Let us say you have a texture for the mesh you created, how do you not make the emmisive work when you’re not on it so you can see the texture? but when you step on it the custom platform lights up?
do you just add the texture you want to use in the emmisive material?
Connect texture it as Base Color and emmisive. Then it will be visible without light, but when You step on it, the texture will start to emit light.