void ANetworkController::ReceivedSelectCamera(msgpack_object* Data) { FString name = Unpack<FString>(Data); APlayerController* PlayerController = NULL; for (auto Iterator = GetWorld()->GetPlayerControllerIterator(); Iterator; ++Iterator) { PlayerController = *Iterator; break; } if (!PlayerController) { return; } //PlayerController->PlayerCameraManager->PlayCameraAnim() for (TActorIterator<ACameraActor> ObjIt(GetWorld()); ObjIt; ++ObjIt) { ACameraActor* Camera = *ObjIt; //GEngine->AddOnScreenDebugMessage(-1, 60.f, FColor::Yellow, Camera->GetName()); if (Camera->GetName() == name) { PlayerController->SetViewTarget(Camera); AFollowRoadCamera* FollowRoadCamera = Cast<AFollowRoadCamera>(Camera); if (FollowRoadCamera) { FollowRoadCamera->Start(false, 0); } return; } } }
void AmyBallPawn::Move_YAxis(float AxisValue) { //テスト入力です。場合によっては自分で動かす為 ACameraActor* camera = dynamic_cast<ACameraActor*>(GetWorld()->GetFirstPlayerController()->GetViewTarget()); if (camera){ FVector forward_vector = camera->GetCameraComponent()->GetForwardVector(); // Move at 100 units per second right or left (1 秒間に左右へ 100 単位移動) CurrentVelocity += (forward_vector * FMath::Clamp(AxisValue, -1.0f, 1.0f) * 10.f); } }
//------------------------------------------------------------------------- // //------------------------------------------------------------------------- ACameraActor* FFbxImporter::CreateCamera(FbxCamera* InCamera, UWorld* InWorld) { ACameraActor* UnrealCamera = NULL; FString ActorName = UTF8_TO_TCHAR(MakeName(InCamera->GetName())); FActorSpawnParameters SpawnInfo; SpawnInfo.Name = *ActorName; UnrealCamera = InWorld->SpawnActor<ACameraActor>( SpawnInfo ); if (UnrealCamera) { UnrealCamera->GetCameraComponent()->FieldOfView = InCamera->FieldOfView.Get(); } return UnrealCamera; }