The default functionality of the hierarchal generation system in PCG automatically registers pawns actor location as a HiGen Source, rather than its camera component.
This is unsuitable for spring arm setups.
We’ve come up with a workaround where we attach a child actor component with a PCG Generation Source component directly to the camera.
This however does not unregister the spring arm pawn as a generation source, so we end up with two radial generations occurring on screen. One for the target of the spring arm (pawn location) and one at the camera’s location.
Steps to Reproduce
Create PCG graph with Hierarchal Generation
Create Player Pawn with Camera attached to Spring Arm
Play in Editor - Generation will occur based off of the pawns root position rather than the camera location
Hi Matthew,
We’re adding the functionality to disable the player controllers-as-generation-sources in 5.7 so I think that will solve this issue.
In the meantime, I don’t think we have a good solution except for you to change the code (esp. since you are on 5.5).
Editing the runtime generation scheduler so it does not pickup the player controllers automatically should be pretty easy.
Let me know if you need a concrete code example for this.
Cheers,
Julien
Ok, so here are two approaches for you:
- Either comment or guard with a cvar the code in FPCGGenSourceManager::OnGameModePostLogin - requires an engine change.
`// new console var
static TAutoConsole CVarEnablePlayerControllerGenSources(
TEXT(“pcg.EnablePlayerControllerGenSources”),
true,
TEXT(“Controls whether players controllers will be registered as generation sources.”));
void FPCGGenSourceManager::OnGameModePostLogin(AGameModeBase* InGameMode, APlayerController* InPlayerController)
{
if (InPlayerController == nullptr || InPlayerController->GetWorld() != World)
{
return;
}
// Check our cvar
if (!CVarEnablePlayerControllerGenSources.GetValueOnAnyThread())
{
return;
}
…
}`2- Some code runs after game mode post login that goes and removes the player controller gen sources from the gen source manager.
Unfortunately this requires 5.6 since in 5.5 that class was not part of the public API.
The crux of it would be essentially what’s done in FPCGGenSourceManager::OnGameModePostLogout.
This shouldn’t require an engine change but some native code.
`UPCGSubsystem* Subsystem = UPCGSubsystem::GetInstance(World);
FPCGGenSourceManager* GenSourceManager = Subsystem->GetGenSourceManager();
TSet<IPCGGenSourceBase*> GenSources = GenSourceManager->GetAllGenSources(Subsystem->FindPCGWorldActor());
… iterate on GenSources and remove them if they are castable to UPCGGenSourcePlayer …`Let me know if you need more information.
Cheers,
Julien
Hey, yeah if the code example would work as an extendable class and not require an engine rebuild, that would be great!