USceneComponent Transformation


How do you get a final transformation in a Component Tree?
How do you attach ACameraActor to UCameraComponent or USpringArmComponent?

So I have a USceneComponent *RootComponent that has child components: USpringArmComponent-> UCameraComponent

I’m setting Location of RootComponent in an overriden Tick function, like this:

void Tick(float DeltaSeconds)
    RootComponent->SetWorldLocation(Location); // This seems to work
    RootComponent->UpdateChildTransforms(); // Don't know if needed

    FTransform T = RootComponent->GetComponentTransform(); // Does not work
    FTransform T = RootComponent->GetComponentToWorld(); // Does not work
    FTransfrom T = Camera->GetComponentTransform(); // Does not work

    // This gets the right location
    FVector Loc = RootComponent->GetComponentLocation() + Camera->GetComponentLocation(); 

I have been searching for hours and can’t find how to do this.

I spawned an ACameraActor into the world and i’m trying to set transform for the actor because I can’t get the parenting to work.

// Does not work
CameraActor->ParentComponentActor = this;

// Does not work

// Does not work
USceneComponent *CameraRootComponent = CameraActor->GetRootComponent();
CameraRootComponent->AttachTo(UCameraComponent *Camera(From above));
// Does not work

Only thing I got working was

FVector Loc = RootComponent->GetComponentLocation() + Camera->GetComponentLocation(); 

Looking at ACameraActor source code I see that it creates an UCameraComponent as RootComponent so that does not need to be recreated.

I don’t think ACameraActor can have a parent.

I ended up going with blueprints.
My gamemode on BeginPlay spawns my camera blueprint at start.