This will match at 60 fps for example, but is much faster at higher frame rates. I think I need to multiply something else by world delta seconds, but I’m not sure what or where, I seem to have tried everything.
Anybody have any idea how to do this, or can give me a clue? I tried looking in the charactermovementcomponent.cpp for clues on how they did it in c++, but couldn’t really find it in that.
Strangely enough, I answered this exact question earlier, here’s the gen:
Say ( just for example ), you’re running at 100fps, and you have an object moving on tick across the screen. If you move that object 1 unit per tick ( per frame ), it will take 100 frames to move 100 units. This is 1 second.
But the same sequence, for someone running at 50fps, will take twice as long. Because the object still has to move 100 units, but now it will take 2 seconds.
Delta time, is how long the last frame took to render, in seconds.
For you, delta time is 100th second. For the slow machine, delta time is 50th second. It’s twice as big.
For the person on the slow machine, the frames are taking twice as long to draw, their delta time is twice as big as yours. So if you multiple ( in some way ) by delta time, the object will move twice as quick. That’s what you want…
Multplying by delta time is only relevant for things which are moving a fixed amount of units on tick. The good thing about timelines is they always take the same amount of time to execute, no matter what the hardware.
I’m not sure how a timeline could be used for something like this, or maybe you are just saying it is good they are frame rate independent?
You say that “Multplying by delta time is only relevant for things which are moving a fixed amount of units on tick”, ok but how do I make an acceleration frame rate independent then? Surely it is possible because it works with the character movement component, and that doesn’t use physics by default.
To make it work at different frame rates you must take into account the delta time. Let’s say for 60 frames per second it would be something like this.
(1/60) * constant speed at which you want the body to move. Then if we talk about acceleration the speed increases at the rate of acceleration and you have to take into account the time the object started moving and the current time and this is multiplied by the acceleration factor to find the constant speed at that instant. https://www.juegocaca.com/juegos-friv