void ASquadNetworkCharacter::RotateForward_Implementation(float Value)
{
if ( (Controller != NULL) && (Value != 0.0f) )
{
GEngine->AddOnScreenDebugMessage(-1, 0.5f, FColor::Red, TEXT(“Rotating right now”));
GetCharacterMovement()->bOrientRotationToMovement = false;
bUseControllerRotationYaw = true;
SetRotation_Implementation();
}
else
{
GetCharacterMovement()->bOrientRotationToMovement = true;
bUseControllerRotationYaw = false;
}
}
void ASquadNetworkCharacter::SetRotation_Implementation()
{
RotAxisValueX = GetInputAxisValue("TurnRate");
RotAxisValueY = GetInputAxisValue("LookUpRate");
ControllerVec.Y = RotAxisValueX;
ControllerVec.X = RotAxisValueY;
ControllerRot = UKismetMathLibrary::MakeRotFromX(ControllerVec);
Controller->SetControlRotation(ControllerRot);
}
// header file
UFUNCTION(Server, Reliable, WithValidation, BlueprintAuthorityOnly, Category = "Controller")
void RotateForward(float Value);
UFUNCTION(Server, Reliable, WithValidation, BlueprintAuthorityOnly, Category = "Controller")
void RotateYaw(float Value);
UFUNCTION(NetMulticast, Reliable, BlueprintAuthorityOnly, Category = "Controller")
void SetRotation();
I call these functions from PlayerInputComponent – by BindAxis
Rotation only happens for client, doesnt replicating to others. I thought SetControllerRotation was replicated by default?