SetActorRotation on your character after a Timer glithes the camera

We have detected a problem while setting the location or rotation of character with a camera component. If you do a SetActorLocation or SetActorRotation on a method called by a Timer, the camera makes a weird turn, just for a milisec. This can be tested really fast with a ThirdPersonExample template and a few lines of code:

FTimerHandle TimerHandle;
GetWorldTimerManager().SetTimer(TimerHandle, this, &AThirdPersonTestRotation::SetRotationByTimer, 1.0f, false);

void AThirdPersonTestRotation::SetRotationByTimer()
{
FRotator NewRotation = GetActorRotation();
NewRotation.Yaw -= 20.0f;
SetActorRotation(NewRotation);
}

Our conclusion (may not be correct, but fits the bug noticed): We think this is caused due to the timer working on a different thread (definitely not working on the main logic pipeline). The components of an actor have to follow this last one, and they should do it on the global tick, having a small delay after rotating or moving the player. This would be unnoticed with any component but the camera, as it is the one defining what you see on your screen.

1 Like

Hello,

Weā€™ve recently made a switch to a new bug reporting method using a more structured form. Please visit the link below for more details and report the issue using the new Bug Submission Form. Feel free to continue to use this thread for community discussion around the issue.

https://epicsupport.force.com/unrealengine/s/

Thanks

I ran into this as well - you can store your desired location/rotation change, and a flag to indicate there is a change to apply, and then in the ā€˜Tickā€™ function you can check for the flag, apply the location/rotation change there, and then unset the flag.

I also run into the problem in 5.0 while using blueprint. Adding a delay node with a duration of 0.0 before the ā€œSetActrorRotationā€ fixed it.