Ok, so I set my Character up with a Camera component.
/** First person camera */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Camera")
class UCameraComponent* FirstPersonCameraComponent;
Constructor:
/* Create the camera component */
FirstPersonCameraComponent = PCIP.CreateDefaultSubobject<UCameraComponent>(this, TEXT("FirstPersonCamera"));
FirstPersonCameraComponent->AttachParent = GetCapsuleComponent();
// Position the camera a bit above the eyes
FirstPersonCameraComponent->RelativeLocation = FVector(0, 0, 50.0f + BaseEyeHeight);
// Allow the pawn to control rotation.
FirstPersonCameraComponent->bUsePawnControlRotation = true;
The blueprint for that character looks like this.
I cannot make the Camera Movable or change anythign on the camera. When I try to manipulate the camera from C++ it fails as well.
if (Player->FirstPersonCameraComponent) {
Player->FirstPersonCameraComponent->SetRelativeLocation(FVector(0, 0, 0));
}
It never process the statement inside the if, because the CameraComponent seems to be zero.
What am I doing wrong here?