how to get elapsed time since button pressed?
Guys,i cant find a solution to this and it seems it would be so simple.I setup this blueprint so i can have slow motion and it works,but i want the transition to be smooth,so i need the time dilation float value to go from 1.0 to 0.15 smoothly.I already created a curve float but i can't find a way to know the elapsed time after i press my slow motion key(i need to know so i can tell this value to the float curve and it can make the transition accordingly.)Please,i cant find help anywhere else,can someone help me?
asked Jul 11 '18 at 02:57 PM in Blueprint Scripting
When you press your button you can "Set timer by Event" and use the output of this to "Get Timer Elapsed By Handle".
This will give you the duration since the last press.
Drag off the red event parameter for the Set Timer node and type "Custom Event" and make a new one. You can have this event do something if you wish.
answered Jul 11 '18 at 03:41 PM
if you have boolean that says whether you are in slow-mo or not, then just interpolate float value between 1 and 0.15 in Tick method. You can use this node: http://api.unrealengine.com/INT/BlueprintAPI/Math/Float/Lerp/
Then you can use DeltaTime in the Tick method to change value of Alpha, let's say you want to change value by 0.5 per second (that means that you get from 1 to 0.5 in 1s), you can compute alpha value for each frame as:
lerpSpeed = 0.5
currentAlpha = currentAlpha - deltaTime * lerpSpeed
(or use + if you wanna get from 0.15 to 1)
Hope it helps.
answered Jul 11 '18 at 03:33 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here