My repeating grid using SetActorLocation is overlapping itself, suggestions?

I have cubespawner which spawns my grid of cubes off the inputs i give it.
Each CubeBP is set to go in X direction and a ‘speed’ set by SetActorLocation hooked up to a timeline. What happens, is the higher the speed, the greater lapse there is in moving the cube from the End to the Start. Even at a constant number like 10, there is still lag.

How can I get my cubes to move at the same speed and manipulate them at a whim, like through an animated timeline? I want to move it eventually in both X and Y directions but cant get them in X correctly, so looking for a solution to that first.

Here’s a video of the spawner spawning the cubes and the ‘speed’ creating overlaps and gaps in them:

You’ve got two main problems there.

  1. You using the timeline as input for the interp instead of delta time

  2. You can’t run a timeline ‘within’ a tick process. Well, nobody’s going to stop you, but it doesn’t mean anything, because the tick node is happening every frame, and so is each increment of your timeline. So what does it mean when you plug the two together? Who knows…

Lemme think a bit…

Do you just want the grid to move around, or do you want the cubes to disappear then they get to the edge ( and other spawn in )? ( Latter I think looking at your vid ).

All this is inside an actor BP.

Construction script:

Make location function:

Event graph:

This is changing X and Y:


Changing Z also wouldn’t be much of a push…

If you watch the yellow one, you can see the remapping order, you might need to tweak that to your taste:

I am extremely grateful for your help! I saw your reply the day you posted and am still in awe how you figured this out so quickly. I still dont know how you were able to come up with this magic, and so fast.

I set the Offset to follow a Timeline that’s run on BeginPlay, and i dont see any issues but is this not optimal?

Also, I’m trying to have another Actor, “Finger” that when it touches each cube (static mesh component), it should turn the cube invisible, BUT when it ‘resets’ in the grid I want it to reset its visibility back “on”.

I tried to create it as: ‘check to see if respawning; if false keep current visibility, if true set visible on; check if touch ‘finger’; if true then turn component invisible’

I got it working for the most part, except that it only ‘resets’ visibility when moving in X- direction, not X+. I believe I need to change one of the ‘checks’ in the Make Location function but im not sure how because i dont fully understand the math here.

The conflict I think is the Timeline when set to ‘timeline.float = MakeLocation.Offset’, and the Branch ‘if TmpResult < SquareSize x -1’.

Would you mind explaining to me how the 'reset location' part works on the Make Location Function please? Maybe then i can find a solution. I'm also curious how you set the colors in your example if you dont mind explaining or screenshoting. Did you just use a ForLoop for the first few in the index?

Anyways, sorry to bombard you with more questions when you already gave me full a blueprint overhaul, which again I’m really grateful for!

Thanks again!

Hi - you’re welcome :slight_smile:

Thing is - it’s very difficult to help you if you have changed the code. I’m pretty sure the timeline won’t work, as the reset concept works by wrapping locations. Are you ok to just get it working with the code I’ve given first, then we can work on colors and visibility etc. I think these will be just a couple of nodes after that…

Yea im perfectly fine with just hearing out how your original code works and the colors and visibility if possible.

The “Offset” variable was created to be the controller of the grid movement, am i correct? I want to animate the grid ‘scrolling’ in different directions throughout the animation, and i dont know how to move the cubes along an animation any other way than a timeline.

This is the crucial piece of code:

The cubes will go in any direction, because it’s set by this vector


( it’s just a vector, split open ).

Timelines also use tick, so you might as well use tick here, because there’s nothing to connect the timeline with. There’s no variable that’s going from 0 to 1 etc, it’s a constant relative increment, which is what you need to get the displacement to work.

The colors were just done on the end of the construction script here

Once I’ve added the mesh component, I just give it a dynamic material and set the color randomly. The branch, means the likelihood of setting a color at all, is 1 in 4.