Skip to content

Commit 2e976b5

Browse files
[UNR-4795] Reset server movement data on local client possession. (#242)
1 parent c5daa52 commit 2e976b5

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed
11.9 KB
Binary file not shown.

Game/Source/GDKShooter/Private/Characters/GDKCharacter.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,3 +209,8 @@ bool AGDKCharacter::CanBeSeenFrom(const FVector& ObserverLocation, FVector& OutS
209209
OutSightStrength = (float)PositiveHits / (float)NumberOfLoSChecksPerformed;
210210
return PositiveHits > 0;
211211
}
212+
213+
void AGDKCharacter::ClientMovementReset_Implementation()
214+
{
215+
GetCharacterMovement()->ResetPredictionData_Server();
216+
}

Game/Source/GDKShooter/Public/Characters/GDKCharacter.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ class GDKSHOOTER_API AGDKCharacter : public ACharacter, public IGenericTeamAgent
7878
UFUNCTION(BlueprintNativeEvent, BlueprintCallable)
7979
void StartRagdoll();
8080

81+
// ----- HACKY WORKAROUND, KEEP AWAY FROM PRODUCTION CODE ----
82+
// This class is used by simplayer, which locally replaces the Pawn's controller without the server's knowledge
83+
// Unpossessing a character resets its movement data, so this is used to inform the server that it happened.
84+
// Getting rid of this hack means adding AIController-like capabilities to the regular PlayerController.
85+
UFUNCTION(BlueprintCallable, Server, Unreliable)
86+
void ClientMovementReset();
87+
8188
private:
8289
UFUNCTION()
8390
void DeleteSelf();

0 commit comments

Comments
 (0)