"Add Local Offset" with "get real time seconds" strange offset

I’m trying to make a simple arrow animation going up and down, I need it to work on editor (in simulation is much more simple). For some reason I can’t make it work using a simple sequence animation, so I decided to animate with blueprint, with a custom event function that simulates tick in editor, like that:

For simplification, behind the “make vector” Z there is “get real time seconds” and a Cos function node, to simulate the arrow going up and down on Z axis. The problem is overtime the offset grows more and more: if the arrow starts going up and down to Z=1 and Z=-1, after some cycles it will go Z=1,1 and z=-0,9… and keep going on, so I need to reset the position everytime. There is something I’m missing in the calculations?

You’d be better off using a timeline for such a task :blush:

To do that, place a timeline node into the Event Graph, double click on it, inside, you should see the icon of an arrow curling into an ellipse shape, click on it to loop the timeline. Then add a new float track to it from the plus (+) icon on the top left, draw the graph to your liking, you can also add some curves if you want, and use that value to set the z component of your object’s local offset.

Some additional notes, you don’t actually need to have a float track or enable looping, as you can also utilize the Play from Start & Reverse from End or Play & Reverse input exec pins of the timeline node. And also, make sure to trigger the timeline only once for it to keep triggering the execution chain after the Update pin throughout the set duration.

Hope this helps! :innocent:

There is a lot of moving platforms tutorials out there (just don’t try to move them sideways and think they will smoothly push the character hehe) and perhaps one of those could be used here. And like the previous poster said, a timeline might be ideal here because of the loop nature. But I thought there was a built in component for this kind of up and down platform movement thing.

Interp To Movement Component

I still prefer timelines for this type of movement. More control. Definitely easier to sync (as close as possible) in multiplayer.

1 Like

Ahh yeah there it is Rev, thanks! And you really seem to know a lot about the multiplayer aspects of this engine. Hopefully I will get there someday.