SetActorLocation not doing its thing precisely

Hello! I have a bit of a problem, i can`t get my head around. I have some platforms that are moving along the x axis using a BP component. When some things trigger, a diffrent platform is moved exactly 500 units behind the moving platforms. The problem is that sometimes the platform moves 494 units behind the other platform, which causes some z-fighting issues, which are not visualy pleasing. I thought that while the SetActorLocation is executed, the actor is moving, so this glitch happens. But i tried adding the component after the function is finnished and it does the same thing.
Here is the component:

And the SetActorLocation:

When you move the 2. platform behind the 1. platform, should they be combined / attached? Is the 2. platform already in the game or is it spawned when triggered? You could attach the 2. platform to the 1. platform with a relative offset and though they would act as one.

I created an example platform. It moves per tick in the direction of the forward vector. It only moves when IsNotAttached is true. Why this boolean? See 2. picture.

Just to show what is happening: When I start the level (or trigger or…) after a delay of 2 seconds I spawn another platform. The platform has the location of X 500 Y 0 Z 0. Then I attach this platform to the other platform in the level which is already placed an moving (GetAllActorsOfClass => Get 0 there is just one). The Location becomes relative to its parent because I choose KeepRelative in the AttachActorToActor node. The SpawnActor has set the boolean IsNotAttached to false because it gets attached and this way it does not have a relative movement from its EvenTick. Only the 1. platform is moving and the other one is attached without moving.

To see the boolean in the SpawnActor node you have to set it to Editable and ExposedOnSpawn in the platform blueprint (here called ATTACH)

Maybe you can use this in your game, if not: tell / show us some more details :slight_smile:

Ok i figured it out. I followed your advise, but i couldn’t exactly make it work in my situation. It was hard to setup a “Anchor”. But i got an idea for a workaround. I simply removed the scrolling component from the platforms and attachted it to a new actor that sits bellow the level. After that i attach all platforms to it with KeepWorld Transform and it works perfectly. Thank you for the help, this has been bugging me for the past week :slight_smile:
Edit: Do you know if its going to be a problem if the aditional actor goes too far away from the world origin?