Hi guys, I am making an OTS (Over The Shoulder) camera. I have 2 spring arms. The first one is the main one with length 300, and the second one is an extension with length 100 rotated -90 degrees so that the end of it is 3m behind the character and 1m offset over the right shoulder. Finally I am trying to attach the FollowCamera to the end of the extension SpringArm, but it actually attaches to the main SpringArm. Why is this happening?
Here is the code:
// Create a camera boom (pulls in towards the player if there is a collision)
this->CameraBoom = PCIP.CreateDefaultSubobject<USpringArmComponent>(this, TEXT("CameraBoom"));
this->CameraBoom->AttachTo(this->RootComponent);
this->CameraBoom->TargetArmLength = 300.0f;
this->CameraBoom->bUseControllerViewRotation = true;
// Create an extension for the CameraBoom. This extension is used of OTS (Over The Shoulder) view
this->CameraBoomExtension = PCIP.CreateDefaultSubobject<USpringArmComponent>(this, TEXT("CameraBoomExtension"));
this->CameraBoomExtension->AttachTo(this->CameraBoom, USpringArmComponent::SocketName);
this->CameraBoomExtension->TargetArmLength = 100.0f;
this->CameraBoomExtension->bUseControllerViewRotation = false;
this->CameraBoomExtension->SetWorldRotation(FRotator(0.0f, -90.0f, 0.0f));
// Create a follow camera
this->FollowCamera = PCIP.CreateDefaultSubobject<UCameraComponent>(this, TEXT("FollowCamera"));
this->FollowCamera->AttachTo(this->CameraBoomExtension, USpringArmComponent::SocketName);
this->FollowCamera->bUseControllerViewRotation = false;