Hello,
Currently I am facing an issue with my Client to Client Replication of my characters Control Rotation.
The current setup I am using is that the mouse rotates the characters spine when aiming in a FPS game. This works just fine using GetControlRotation() but replication only works from Client to Server and Server to Client. If there are 2 clients and 1 server, then the other clients cannot see the rotation.
To fix this, I used a NetMulticast to replicate another variable every time the mouse sends input, but this technique leads to a lot of bone jittering when played online.
Does anyone know how to easily replicate this bone rotation in a smooth way?
Below is my C++ and BP’s
Animation Instance BP
Animation Instance Anim Graph
AnimInstance C++
void UShooterAnimInstance::NativeUpdateAnimation(float DeltaTime)
{
RemoteAimRotationPitch = -ShooterCharacter->AimRotation.Pitch;
LocalAimRotationPitch = -ShooterCharacter->GetControlRotation().Pitch;
}
Character C++
void AShooterCharacter::CameraLook(const FInputActionInstance& Instance) {
AddControllerPitchInput(-Instance.GetValue().Get<FVector2D>().Y * CameraRotationRate);
AddControllerYawInput(Instance.GetValue().Get<FVector2D>().X * CameraRotationRate);
ServerSetAimRotation();
}
void AShooterCharacter::ServerSetAimRotation_Implementation()
{
MulticastSetAimRotation();
}
void AShooterCharacter::MulticastSetAimRotation_Implementation()
{
AimRotation = GetControlRotation();
}
UFUNCTION(Server, Reliable, BlueprintCallable)
void ServerSetAimRotation();
UFUNCTION(NetMulticast, Reliable)
void MulticastSetAimRotation();
UPROPERTY(Replicated)
FRotator AimRotation;