Hi! This works for the server, but not for “Play as client”. I can’t understand why. Thanks for any hint.
While the same logic in the blueprint is processed correctly
APawnCameraController::APawnCameraController()
{
//bShowMouseCursor = true;
//PrimaryActorTick.bCanEverTick =false;
//PrimaryActorTick.bStartWithTickEnabled =false;
MoveForwardName = "MoveForward";
MoveRightName = "MoveRight";
RotateYawName = "RotateYaw";
}
void APawnCameraController::BeginPlay()
{
Super::BeginPlay();
}
void APawnCameraController::SetupInputComponent()
{
Super::SetupInputComponent();
check(InputComponent);
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, FString::Printf(TEXT("TEST: SetupInputComponent")));
InputComponent->BindAxis(MoveForwardName, this, &APawnCameraController::MoveForward);
InputComponent->BindAxis(MoveRightName, this, &APawnCameraController::MoveRight);
InputComponent->BindAxis(RotateYawName, this, &APawnCameraController::RotateYaw);
}
void APawnCameraController::OnPossess(APawn* InPawn)
{
Super::OnPossess(InPawn);
PawnCamera = Cast<APawnCamera>(InPawn);
}
void APawnCameraController::MoveForward(float Value)
{
if(Value && PawnCamera)
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, FString::Printf(TEXT("TEST: move forvard")));
PawnCamera->MoveForward(Value);
}
}
void APawnCameraController::MoveRight(float Value)
{
if(Value && PawnCamera)
{
PawnCamera->MoveRight(Value);
}
}
void APawnCameraController::RotateYaw(float Value)
{
if(Value && PawnCamera)
{
PawnCamera->RotateYaw(Value);
}
}