Set Actor Rotation sometimes not working

I’m using the Top Down template and I use the following script to rotate towards the cursor (which is called from RMB event):

This function gets called locally on the client. However, the rotation sometimes happens and sometimes it doesn’t. But it always rotates when I’m the server. Why is this? How can I make sure the rotation is ALWAYS happening? There is no other script which is interrupting the rotation.

Thanks in advance!

Anyone familiar?

I could try suggest 2 things but don’t know if they can be usefull ^^

  1. set that the actor to replicated, so when it change on the server it will change on clients too.
  2. Make that rotation function run on the server. Create a custom event and set it to run on server

I have exactly same problem.

  1. Running on a client WITHOUT dedicated server, working well.
  2. WITH dedicated server, calling in neither client nor server work. SOMETIMES not working.
  3. When you call SetActorRotation in SERVER for character A,
    → On Client A : My character A sometimes not turn.
    → On Client B : Character A turns properly.

Return value of SetActorRotation is ALWAYS true. But not turn. WHY???

i have the same issue, it seems only happen on Character with ROLE_Autonomous

before SetActorLocationAndRotation, call Character->GetCharacterMovement()->FlushServerMoves() seems solve this issue, not sure this is the right way to fix this.

1 Like

Same boat here… when I call the rotation it works for every other player but on the local client it works only SOMETIMES. For example, if I call the rotation 10 times, both players can see it well around 5-6 times… the rest, only the other clients sees the rotation but the actual player calling it doesn’t. Same as others, return value from rotation is always true, and every print I made for debuging shows no error, nor in variables, nor in replication (every one recieves the call). I think its a weird bug from the engine itself.

but how you do this from blueprints?

YOU ARE AMAZING! THANKS!

AMAZING! THX!
h:

UFUNCTION(BlueprintCallable, Category = "CppBPFLibrary")
	static void FlushMovementData(class UCharacterMovementComponent* MovComp);

cpp:

void UVR_BPFLibrary::FlushMovementData(class UCharacterMovementComponent* MovComp) {
    MovComp->FlushServerMoves();
}

I’ve stumbled upon this topic and I have the exact same issue. Did anyone find a BP solution to this problem?

I’ve stumbled upon this topic and I have the exact same issue. Did anyone find a BP solution to this problem?

This is still an issue to this day, I found a hack which is calling the add movement input which forces the character movement component to update the rotation

335944-addmovement.jpg

1 Like

This hack works!