I’ve tried hooking up Delta Time to Get World Delta Seconds and Event Tick, with the Interp speed set to all sorts of values, but the switch from the current float value to the target float value is like the flick of a switch, like it’s instantly switching. Am I doing something wrong?
probably…but without posting a setup thats broken for you its hard to guess whats wrong…for me that node always worked like it should.
For a minimal working example, here’s an Actor Blueprint that moves a static mesh component until its relative Z location equals 100, on tick, using FInterpTo, without any flick-of-a-switch type movement, but somewhat rather smooth:
Hey guys, thanks for all the replies!
Xenome, I tried your setup (edited for mine, of course) but still am getting the sudden switch.
Here’s what I’m wanting to use Finterp to for. I have a time of day/weather system I’m working on. Depending on the spot in different timelines, lots of values are being changed. For example, my directional light actor changes intensity based on the, “time of day,” which is dictated by it’s current rotation angle on a 2400 second timeline. However, I also have 3 different, “weather cycle,” timelines, that will affect the values of the time of day cycle additively, so that I can have weather patterns change less uniformly. Basically, say it’s sunny. My time of day system by itself was built on a sunny profile, so things like sun intensity are just multiplied by one for, say, 400 seconds. Then, after the sunny profile timeline plays through, I have an event to fire to select one of the three weather profiles based on a pre-determined probability. So say next it lands on rainy. Out of the gate, the highest intensity I want my sun to be is 1, (during sunny it’s at 20) so that it seems like cloud cover (which is just a texture) is blocking out more light, and affecting overall brightness, like it does when it’s cloudy/rainy. So for the duration of the 400 second rainy timeline, it’s feeding a number (0.1) up to a float * float node, and multiplying that by the current sun intensity on the 2400 second timeline. However, I want it to fade smoothly, and having it set up this way would allow for each weather pattern to affect things like sun intensity, cloud cover, etc, additively, at any point in the day/night cycle, which is a different length than each of the 3 weather pattern timelines, so subtracting/adding values straight across wouldn’t really work, because if say Cloudy played multiple times in a row (something the probability system allows) it could subtract values repeatedly, making it waaaay too dark, whereas if it just multiplied the default Sun brightness by the same number multiple times in a row, it would get as dark as it should and no darker, allowing the system to play over and over without issues. My problem is, I’m running the outcome of the default sun intensity * the weather pattern’s current multiplier into the target value of Finterp to, with the base being just the original sun intensity value as dictated by the time of day system, but it’s just suddenly changing values from 1 to 20 during switches, as opposed to fading smoothly.
Sorry if the explanation seems weird, I’m new to programming in general and this confuses me a lot, though I think in theory it should work. Here’s a picture of my finterp to/sun intensity node setup as I described above.
Can you please try it as shown in a new actor blueprint, place it in your level and play, just to verify that there isn’t something wrong with your editor (highly unlikely, but you know… never assume, always test).
OK, so I didn’t really try to parse that, but looking at the screenshot of your setup, you have some weird concurrency going on there by the fact that there’s a timeline, itself ticking because that’s what timelines do, and then on top of that the ordinary tick event injecting itself into that very same execution thread. This seems (to me at least) like a rather messy situation that’s potentially very difficult to debug (as you have found out).
Assuming that the simple example FInterpTo works as expected on your system, you probably want to rethink the way you are driving your sun/weather parameters and come up with something that’s a bit cleaner and easier to debug.
As a general piece of advice - when you are programming, you are also collaborating with your future self. Always make sure he doesn’t get mad at your present self
I wasn’t really able to do this with a static mesh, because, at least in 4.8, set relative location takes in a vector parameter, and not a float. However, I did test Finterp to using a spotlight actor to raise it’s intensity from 0 to 5,000,000 at a rate of 0.005, and it smoothly built up to that intensity as I want it to in my weather blueprint.
here’s a picture of my spotlight test:
Update: I’ve tested Finterp to on the other situation, even having the target float value being multiplied by other numbers, just to see, and it works just fine.
A more basic explanation of what I’m trying to do:
My directional light actor’s intensity changes on a 2400 second timeline. I want the scale that it ranges from to be affected by other timelines, that output a number to multiply the intensity by. (For example, to make it less intense, I have a timeline that outputs a, “weather sun intensity,” float value (0.1) that my Finterp to node references to multiply my default sun intensity by. So, for 400 seconds, (the duration of that weather cycle) the sun doesn’t shine as bright. This’ll be applied to other values like cloud opacity, fog, etc, for weather cycles.
But I think my issue is the Delta Time input. My Directional Light Intensity is controlled by a timeline, not by event tick, so I’m not sure what to put into the Delta time input in my Finterp to node.
Here’s another snapshot of my setup, I’m not sure why it’s not working, though. Remember, Weather Sun Intensity is just a multiplier to change the scale that the sun intensity ranges from. It’s not changing the sun intensity at all, which I tested to find out by having it print the sun intensity value that’s put out by the finterp to node, and it’s the default value that’s put out by the default sun intensity timeline. Is there a value I can put out of a timeline that would work for Delta Time in finterp to?
Use Play From Start
I don’t understand, how would that affect finterpto?
Ah, whoops, ignore that. What you want to do is “Get World Delta Seconds” and hook that into the delta time. You may need to mess with the interp speed to get the results you want as well.
That one isn’t working either it’s either returning the default sun value, or something super close to it, but it’s not scaling/transitioning towards any other values.
Bump, still seeking a solution to this issue.
Finterpto isn’t working
Has anyone else experienced difficulty with FInterpto? My current and target values can and do change at runtime, and it picks up on that and the output value adjusts accordingly, but no matter what I do with the interp speed and delta time, it just abruptly changes values as opposed to transitioning smoothly like it should, I believe it’s because when the target value changes, it just jumps directly to outputting that value, rather than transitioning to it from the current value. It’s been stumping me for longer than I’m proud to admit.
Try using a TimeLine instead.
If you right click in a BP there should be an Option in the context menu down the bottom that says, add new Timeline.
You can define any type of curve to transition from one value to another.
Check the documentation out or search Youtube for tutorials on Timelines.
You have your FInterp node within a function/event that updates every frame, yes? (For example Event Tick). If not, you’d need to do that first.
Hey hippowombat, I took the liberty of merging these two threads of yours since they are both about the exact same thing. Please don’t start new threads when you already have one going on about the same topic.
Devils D, the problem is that the values I’m editing are already being edited by another timeline, and need to stay within a limited scale along that timeline.
IMC. Wander, I have tried this setup with Event Tick setting a value that is called on by my, “base,” timeline, but it still isn’t working.
And Xenome, I’m sorry for my confusion, I won’t do it again. Thank you for fixing the threads for me
The reason it isn’t working in your current setup is that you are always interping between two numbers without changing the current target value. So it gets stuck at the first step essentially.
For any of the interp nodes to work, you need to actually set the current value on the update. You are setting the light intensity but not getting the light intensity as the current value. You did it that way in the simple example above so it worked.
Perfect, I was able to confirm this by testing it on the dynamic fading in/fading out of campfire ashes using these instructions.
Thank you so much!
So this still isn’t working for my weather system, I’m at a loss. Weather Sun Mult is the number for sun intensity based on the time of the day and is updated via a 2400 second timeline, Target Mult is the multiplier to scale the overall values depending on the current weather profile and is controlled by one of three 400 second timelines, that only play one at a time based on probability. Sun intensity stays 20 regardless of time of day.