All AddImpulse functions are suddendly behaving differently

Hi everyone,

This is my first time asking a question on UE4: I learned blueprints with an online class, and I’m now working on my first project. I’m using the 2D Side Scroller setup as a base.

Something odd happened between the moment I went to bed, and this morning:
My main character suddendly started jumping way higher than it did last night.
(The Jump function didn’t do what I wanted, to I coded my own using a “AddImpulse” function)

Then, I noticed that another object, which was also using “AddImpulse” to move around, was moving way faster than last night.
At some point, I’m pushing it towards the right of the screen, and it now goes double the distance it went previously, with the same amount of impulse (I didn’t change anything).

So… I’m a bit lost! I’m looking for a general “Air Friction” parameter that could have changed, but I don’t see anything.

Would anyone have an explanation? I could readjust all my AddImpulse amount, but I’m worried it’s going to change again in the future.

Thanks,

EDIT: After digging a bit into it, it seems that the Impulse quite exactly “doubled”.
I divided all values by half, and the behavior returned to what I had before, quite precisely.

EDIT2: And now (=20 mins later + I still didn’t change anything apart from dividing the AddImpulse values by half), everything went back to what it was at first. Meaning that, because I divided by half, everything is now very slow.
If I double the values again, it’s working.

So there is a parameter that can apparently divide everything by 2, and then go back to normal.
That made me think of the framerate: that was the solution. Switching from 30FPS, to 60, or 120, drastically modify any AddImpulse function.

Is there anyway to fix that?

Hey there,

Unfortunately since it is related to physics it seems it is frame dependent. A workaround around this could be by normalizing the Impulse value by the WorldDeltaSeconds, although you will have to find the proper value again. I hope that helps!

Also, if you are interested, this was linked in a different post regarding this issue

Link

Cheers,
David

Hey David,

Thank you for your answer!
So, I indeed multiplied the Impulse by the World Delta Seconds (after adjusting the value), the result now feels stable.

Though, I have a few AddImpulse that are connected to Timelines, not Event Tick (for example, to make my character jump higher if the jump button is hold, or give a progressive one time push towards a direction).
When normalizing with the World Delta Seconds, I get a bit more stability but there is still a noticeable difference (my character jumps higher if the FPS are lower).

I think I can get out of it by adding a boolean connected to Event Tick, but I just wanted to know: is connecting Physics to Timelines generally discouraged / considered a bad practice? Is it better to connect everything to an Event Tick?

Did you have this issue with the timelines before the normalization? If I am correct, the timelines are locked to a particular fps value, so you should not see any difference there. Anyways, if you are using the timeline to only simulate a tick (just a linear function), I would recommend using a Timer instead and set whatever intervals you need the impulse function to trigger. Also, a tick is ok