SetActorLocation is not instant 4.11

When using the SetActorLocation node the movement is not set instantly, there appears to be a lag of a few frames.

To reproduce

  1. Set game mode override to none so the default player pawn is used
  2. Create an actor blueprint, lets call it Test
  3. Open the blueprint editor for test and create a cube objects as a child of root, set the x position of the cube to be -300
  4. Set Test to follow the player like so

  1. Play and move around

Hey Hmb3141-

Can you include a short video of what you’re seeing? I followed the setup steps you provided and the cube was following all of my character’s movements (running, jumping, etc) smoothly.

What you See on the Cube is most likely TemporalAA (Anti-Aliasing, Change to none under Project Settings->Rendering)
And regarding the Shadow thats Motion Blur (Also under Project setting->Rendering)

Turn both off and you wont notice anything anymore. Its just purly Visual the Set Location happens instantly.

I tried disabling both of these but I still see the same thing. Here’s a video of what I’m seeing - YouTube

Keep in mind that you are setting the new location on tick. As you move, the cube’s location will update on the following tick after it registers the change in location. If you place the cube at the world origin (0,0,0) and use SetActorLocation on a keypress to another location (100,100,100) the cube should move instantly.

So, is there a solution where I won’t see this delay?

I would imagine that even with one frame behind there should barely be visible difference anyway running at 60fps

Rather than using Set Actor Location you can try using AddActorLocalOffset. This will move the actor by the specified values in the given direction. So a value of (1.0 , 0.0 , 0.0) would end up moving the actor along the X axis at 1 unit per tick.

So to get an object to follow another object I would have to check the change in transform from the previous frame and apply this offset to the cube.

Surely there is another way, is this lag the expected behaviour or is it possible I’m doing something else wrong?

Here is a quick setup that causes the blueprint actor to follow the player until it gets within a certain distance of the player and then stop. Note that it uses AddRelativeLocation rather than SetActorLocation to move the actor.

this doesn’t work. Is there really no built in way to accomodate a prediction for velocity when using setactorlocation?

you ever figure out a solution? This problem seems absurd

So I found the actual answer, the trick is to make sure your event tick for “set actor location” is in the right tick group. The blueprint key is “set tick group”, most likely to the “post physics” tick group. Works like a charm.

Yeah, this is perfect. Thanks!