BP_Actor instance location is not getting updated as per Timeline

I created a Parent BP and a child BP from it. i added the timeline in parent BP which updates world location of the actor.
And when i put some of the child actors instances into the view port and assigned parameters specific to timeline which are different among each of the instances. Instances are getting updated sometimes and sometimes they do not move at all which in latter case i put a debug point in the timeline logic and seeing the location is being updated without any issues.

Can someone please help me with this problem i am facing.

I can’t see anything specifically wrong right now, can you show what you’re trying to do?

I can tell you that, the way you’ve written it, the animation will be framrate dependent. You’ll need to multiply by world delta seconds to cancel that out…

I am trying to randomize the movements of the actors based on the parameters they are given. Looks like i made some logic change and everything is working fine except for one. In the video shared (selected actors (at the end of video) are not being updated from the start after changing their parameters. Is this due to timeline is not being starting from the beginning in my logic?

Left most actor - Is in moving in plane but should move along z axis as per params
Right most actor - Is not moving at all but should move along any of the planes XY, YZ, ZX randomly

I used delta seconds for interp and lerp but not with timelines. Can you please tell me how to use delta seconds with timeline from the screenshot i shared in the question?

I’m gonna take a look,but in the meantime, delta seconds.

The problem with moving 2D distance every time is it’s a fixed amount, and the speed of the actors will vary ( a lot ) depending on the machine, FPS.

If you multiply 2D distance by GetWorldDeltaSeconds ( I think it is ), this will compensate for time lag caused by differences in FPS. ( You may also need to multiply by another constant to get your original movement speed, but the this will exactly the same on all machines ).

If you want to see the problem in action, in the console type ‘t.maxfps 20’ and watch everything happen painfully slowly :wink:

The GetWorldDeltaSeconds fix works because it’s the time between frames. On a ■■■■ machine, the time between frames is large, which means that your boxes will move further. Exactly what you want…

I can’t say what the problem is with your algorithm, as I can’t see most of it. I assume you just have another logic slip up somewhere.

What I’ve done is put together another way of doing the same thing. More simple. See what you think.

I’ll put the pictures in there, but also upload the BP as a text file. All you have to do is open the txt file in notepad ( or similar ), select all, copy, and paste into a fresh BP. Then right click all the variables and choose ‘define variable’.

Basically it just stores the position of the original bounding box of the cube. On each iteration, it chooses a random point in that box ( X TravelMultiplier ) and moves to that point.

TravelMultiplier and AxisFilter should be visible in the editor. You can specify which axes the cube can travel on using AxisFilter. A value of 1,1,1 mean 3d, 0,0,1 means only travel on Z etc.

The ‘nasty’ bit of vector math on Destination is just to add the original position on the unused axes to the cube only travels in the planes specified.

Hope you find it interesting… :slight_smile:

[link text][3]

Thanks for the info. This is not what i am trying to do but i like the idea of using a vector as editable param instead of many booleans and strings. And is there any reason to not using delta seconds?
I am more confused with it. Lets say i need to move actor 250 units(2D distance) in 4 seconds(timeline length) and if i chose the constant as 10, to make animation fps independent i need the
result = 250 X delta seconds X 10 X timeline curve value, And then actor is moving different distances based on fps i set in the animation.

Is there a way to determine the constant that works better on most FPS settings? Am i missing something. Is my understanding of delta seconds correct?

I shared the logic i am using (might not be that efficient). Can take any kind of suggestions that affects the performance and any code smells.

Just try multiplying your D by delta seconds and all will become clear…

I don’t need to use delta because the timeline is entirely dictating how long the object takes to get from A to B. In your example, the number of times you add your constant is different depening on your FPS.

Again, just try the trick and find out :wink:

I will look at your BPs.

i am using delay thinking only after specified amount of time (“Time to change the path”) check if actor can change his path or not and then stop current playing timeline if necessary and start other timeline.
if there is no need to change the path of actor then there is no need to restart the timeline as i can continue with the present flow.

Can i leave all the timelines start whether actor using it or not ?

Thanks for the help. Will change the logic accordingly

Ok, I’ve set it up, apart from the contents of the timelines for some reason, that didn’t make it.

The major problem I see is using a delay on timelines. No can do, sorry buddy :slight_smile:

You see the update pin of the timeline is called every frame, so you need to imagine all the code to the right of that, called every frame.

As you can see, the delay doesn’t mean anything because you just end up with thousands of copies of:

MakePathTransition → TimelineRestart

Also, do you really mean to restart the timeline every frame, or do you mean to call that bit after it’s finished?

If you take the delay out, nothing will change ( I predict ). It’s not doing anything…

Also, maybe watch out, as you are doing a lot every frame, everything on the right happens every frame.

Hi - so I looked a bit further.

I think you might have more joy if you change MakePathTransition to only return an exec pulse if the path actually changes. That way you only get to restart the timeline when something is different.

If you want to make it happen after some delay, two ways come to mind:

  1. Count elapsed seconds. You can use GetGameTimeInSeconds and store it in a variable, when the difference is > 2, then call the node.

  2. Use a timer by event node like I did. Have nothing on the right of the timeline ( except moving the mesh ). When the timer triggers you call recalculatepath and stop and restart the timeline:

If you do this, you can remove everything except the mesh movement from the timeline.

I also have the strange cube-stop effect, am looking at that…

Hi …

Thanks for the tip.Good if we know what is generating stop effect. I have some questions…

  1. If the timer is called when the timeline is in the middle of its length, The recalculated path starts from from that time without completing its current path. Am i wrong?
  2. How to make timeline (length of 4, actor moves from A->B->C->D, each location by 1sec of timeline) work with lerp
    to use delta seconds? I tried by not able to do that, so did some rework and came up with the this (Please look at updated logic and share your suggestions (of course, whenever you can).
  3. Will timeline work with loops (while loop,for each ) ? Came with other way without using them though…

By the way i learnt something new that, I was trying to accomplish which can be done with “Interp to Movement” Component except with random functionality that i have ( I think…OR it has that too with little coding)

Hey Durgaprasad,

  1. When working with timelines you have to calculate ‘start point’ and ‘end point’ before entering the timeline. If you want to stop the time line mid way and change params and start again, you need to re-calculate the start and end point, AND start the TL from the beginning again.

A good habit when working with TLs is to put the bare minimum inside. I know it’s possible to put all sorts of things in there, but it will get to be a real hassle.

A much better way is only have the TL go from 0-1. Then, outside you can use a lerp, powered by the 0-1 to make the changes you want. This way, you can many components with one TL, just a different lerp for each component.

Also take a look at Ease nodes, they are a bit like lerps but configurable.

  1. General rule, work with a timeline OR work with interpto. They don’t mix.

If you’re using f/v/r/interpto, then you need tick, or getworlddeltaseconds. When working with tick, you use the current position and and destination on each tick, in contrast to TL above…

So, if you want to make a component move the many different locations, you can use either of the above methods. If it’s going to be random, once you’ve moved you just re-calculate the new destination.If it’s a specific number of places, put them in an array and use a loop to pick the targets out of the array, running the TL on each. Only change to the next array item once the TL has finished the current one.

  1. Don’t try it with a for loop. It’s very ugly. Up to you, but…