Hi @Rev0verDrive
The command “p.NetShowCorrections 1” shows two capsules (one red and one green).
And a message in the console.
[2024.12.09-04.21.55:986][417]LogNetPlayerMovement:
Warning: *** Client: Error for BP_BlueTeamCharacter_C_0
at Time=102.332 is 10.814 LocDiff(X=-7.084 Y=8.170 Z=0.000)
ClientLoc(X=5006.408 Y=198.262 Z=140.150)
ServerLoc(X=5013.492 Y=190.091 Z=140.150)
NewBase: L_Arena01:PersistentLevel.StaticMeshActor_3.StaticMeshComponent0
NewBone: None
ClientVel(X=548.951 Y=-242.182 Z=0.000)
ServerVel(X=463.707 Y=-355.755 Z=0.000)
SavedMoves 3
I can imagine there is a difference in position between the server and the client. Right?
I assumed that replicating movement would take care of this.
This is the character replication settings:
And this is my movement function:
void AMyPlayer::InputMove(const FInputActionValue &Value)
{
// input is a Vector2D
const FVector2D MovementVector = Value.Get<FVector2D>();
if (!IsValid(Controller)) return;
// find out which way is forward
const FRotator Rotation = Controller->GetControlRotation();
const FRotator YawRotation(0, Rotation.Yaw, 0);
// get forward vector
const FVector ForwardDirection = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X);
// get right vector
const FVector RightDirection = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::Y);
// add movement
AddMovementInput(ForwardDirection, MovementVector.Y);
AddMovementInput(RightDirection, MovementVector.X);
}
The error occurs in this scope
AMyPlayer::InputMove => No Authority / Client / ROLE_AutonomousProxy /
I tried to run the function on the server only
UFUNCTION(Server,Unreliable)
void InputMove(const FInputActionValue &Value);
and also in multicast.
UFUNCTION(NetMulticast,Unreliable)
void InputMove(const FInputActionValue &Value);
But it didn’t fix the problem.
What is wrong? What should I do?
Thank you so much!!