Hey guys, I’m trying to pass in a scene component which is a parent to my camera component so I can switch cameras. The parameters only take an actor so I was unsure what to do, I attempted it with an UActorcomponent but that didn’t seem to work either, does anybody have any experience with this? Here’s what I attempted so far -
[FONT=Courier New]CameraParent = CreateDefaultSubobject<USceneComponent>(FName(“Camera Parent”));
CameraParent->SetupAttachment(RootComponent);
Camera = CreateDefaultSubobject<UCameraComponent>(TEXT(“ActualCamera”));
Camera->SetupAttachment(CameraParent);
Then the function looked like this -
[FONT=Courier New]void ASwitchRoom::BlendToCamera()
{
OurPlayerController= UGameplayStatics::GetPlayerController(this, 0);
AActor* NewCameraPosition = Cast<AActor>(CameraParent);
if (OurPlayerController)
{
OurPlayerController->SetViewTargetWithBlend(NewCameraPosition, 0.65f);
}
}
When I run this function the blend actually blends to a first-person view of the player which is not intended and unsure how it even happens tbh.
I’ve attached a screenshot of the hierarchy in the editor as well, Thanks in advance!