Timeline and Offset Combo failure

Hey there,
we have a problem in our game.

We are using the Timeline with Add Actor Offset to move the player in a specific direction. (The Player can still control the PlayerMesh, thats why we need Add Actor Offset)
The Player makes two moves in one timeline. The first one on +50X and then back to his Start Position -50X with linear transition.

The problem is that the player never gets exactly back to his start position (After the -50X Move)
And while playing, he offsets more and more until the game is no longer playable.
Its like he doesnt move back -50 on X, its like he moves maybe 49,95 back or something similar.

We found a bad workaround for this by adding a second timeline which moves the player back to his “real” startposition in a short amount of time (0.01)
But the problem is that the player then always “twitches” back to his position and this doesnt look allright even with a smooth timeline curve :frowning:
The second timeline needs to be short, because the player is not able to make the X Move until the second timeline is over.

Can somebody help out?


Hey rabidworm333, thanks for your answer.

I will talk to my blueprinter because of your answer thank you.
I also made a little picture to visualize our problem better:

Hm, maybe also the first move is not correct? Maybe already the first move is not exactly 50 and so we have on both moves a incorrect value going on. I mean we typed in the correct values, but the engine does something else :frowning:
And yeah, we need the freedom that the player is still able to control the car on other Axis while making the move, so we are using Add Actor Offset.

Thanks once again!

Is it a curve inside the timeline you are getting the value from? If you are adding float values, then there will probably be a drift as Floats are not precise and can over time add a margin of error.

What first comes to mind is that, before the movement starts, you get actor location and add the final offset and save that vector. Then execute the movement as you do now, but after the finished exec of the timeline, set the actors location to vector. It shouldn’t be noticeable.
Or instead of using a curve value, you can interpolate the actor to the goal location by using the alpha of timeline.getplaybackposition / timeline.gettimelinelength. It’s still a good idea to set actor location to the final exact goal to avoid drift.

Thanks for your answer and therefore time but in sorry to say but that’s already what we are doing now since the x value is different between start and end. I now use a second timeline once the offset timeline is finished that sets the actor location back to its original x location. But there is still the little gap in there that just looks unsmooth.
But again thanks for your time and answer.

Greetings Luis

Thanks for your answer and therefore time.
You mentioned that floats aren’t precise what should I take instead? A vector curve ?

You know what, forget I said that. There are some situations where adding float values can be bad but I don’t think that’s the case in this case. I don’t know why your actor would drift, but setting the final location correctly after movement should fix it, and doing that shouldn’t be noticeable. And if it is, something is off.
And in order to help more precisely, seeing how the actor location is set, where the value comes from that the curve may be of use.

here is a picture of what im doing now
the second timeline is to go back to the origninal x position. but it looks unsmotth on the let is the timeline for the movement.

So I created your setup but with only the first timeline, and it’s pending back and fort precisely. Starting at 0,0,0 , when the timeline finishes I print the actor location and it always returns exactly 0.000,0.000,0.000.
I mean, I’ve only run it for a minute but I’m guessing you are seeing location errors by that time.
Except for now when I alt tabbed, it’s really messing up.
Does that provide any insight? You’re always getting good frame rate when testing?

Edit; Actually the 2 first times it got back to 0,0,0. But now when I run it, it will start at 0,0,0 then return to about X-39 to X-42, but then keep returning to that location. I don’t know why that happens, I’ll fiddle with it some more.
BTW - the truncate helps a lot with the accuracy. Without it, there’s a definite drift.

Yeah I added the truncate to maintain at compete numbers because decimal numbers are definitely messing things up here. And yes we are almost every time getting smooth framerates. Changing it to a vector curve didn’t help really. Adding the 2nd timeline works but it’s unsmooth to see the ship jumping from one position to another sometimes.

weird, before it would always start at 0, end up at -39 to -50 and then be precise from then on.
Now I’m back to it always ending up at 0, except occasionally, it will change. Just randomly end at another location then be precise for a while then change a bit.
My guess is that it is frame dependant to some degree.
Actually. You know what.
This setup adds local offset depending on the returned float. At low floats not much would happen, but say we’re at a high number like 40. Say we get 3 frames between 40 and 41.
40*3=120 units. Now say we only get 2 frames between 40 and 41. It only moved 80 units.
This setup relies heavily on that it adds offset equally many times moving forward as going back. If not, there will be a margin error, very noticeable with floats but relieved by the truncate.
Here’s the thing. The curve changes direction. So what if the one frame ends up on exactly 50 then it’s off by 50 units because it is very unlikely that it will end up on exactly -50 too.
Same goes of other int ranges. Often, you get say 20 frames between each int number, but occasionally only 19. And then it’s completely off, especially if that happens at higher numbers.
Now, this system works kind of surprisingly well for being so frame dependant, but it is a unrealiable system, heavily frame and odds dependant.

I suggest that instead of adding offset, you “set actor location”, where the resulting location is start position which is set before the timeline starts, plus the float value. Then when the timeline finishes, actor location is set to start position. This will involve changing the curve type, but adding offset is just too unreliable.