[4.5] is there a problem with possession with replication?

Hi,

Not sure this is a problem with ue4 or a misunderstanding on my side.

The following thread:

led me to narrow down my problem to the following.

I want my custom playercontroller to possess a target pawn from a client.

This is the RPC in my playercontroller.cpp:

void AyagPlayerController::ControlPawn_Implementation(APawn* TracedCharacter)
{
	if (Role == ROLE_Authority)
	{
		Possess(TracedCharacter);
	}
}

And this is the control definition in the target pawn (both for X and Y axis, on moving mouse):

	FRotator Rotation = PlayerController->GetControlRotation();
	FVector Direction = FRotationMatrix(Rotation).GetScaledAxis(EAxis::Y);
	AddMovementInput(Direction, Value);

This looks like a simple enough configuration, but i get different results on the server and on the client (every actor -including the playercontroller- have their bReplicates and bReplicateMovements set to true).

On the server, the possessed pawn uses its own local referential to move (as intended).

On the client, the possessed pawn uses the initial (starting) pawn referential (the one controlled before the new possession happens).

So it seems that during the possession, the PlayerController location and rotation are not replicated.

Am i doing something wrong ?

Thanks for your help.

Cedric

Maybe i should add that PlayerController is a replicated variable defined in the beginplay function:

void AYagCharacter::BeginPlay()
{
	Super::BeginPlay();
	if (GEngine)
	{
		Super::BeginPlay();
		PlayerController = GetWorld()->GetFirstLocalPlayerFromController()->PlayerController;
	}
}

But i get the same results with:

FRotator Rotation = Controller->GetControlRotation();

so i merely mention it for the sake of completeness.

Cedric

Hi,

Just for the info, in the thread i mentionned in my question, Zak Middleton (staff member) provided me with some way to debug and a workaround so my case is pretty much solved and closed, but the debuging showed some different behavior on server and client sides.

  • on the server, the controller acquires the pawn’s rotation
  • on the client, the pawn acquires the controller’s rotation

I don’t know if this is intended but i think it would be better to have the same behavior on the client and the server (all automatic or all manual, no matter, as long as it is documented).

Cedric