Newbie transforming TPC camera to FPC

It is very straightforward to drag-n-drop a camera out of the CameraBoom in the ThridPerson Template when using Blueprints. I am trying to avoid Blueprints at all costs. Now in C++, when I remove the CameraBoom and try to attach the Camera as a child of the mesh, the following happens:

Even though I get the VS Intellisense error : “USkeletalMeshComponent* is incompatible with parameter of type USceneComponent*”, it still compiles.
The CameraBoom is removed from the ThirdPersonCharacter and the FollowCamera is not attached to the Mesh.

I have watched a few videos stating it should be done this way but I don’t see how this worked. I am using UE4.23.1

The Bone “headSocket” is defined.

Thanks

Follow-up question:
Why is USkeletalMeshComponent not a SceneComponent?

I’m not quite sure what you’re doing there…

you’ve commented out the CameraBoom creation but you’ve referenced CameraBoom on line 47?

then you’ve done two attachments on the FollowCamera?

just do SetupAttachment() and attach it to the mesh not the CameraBoom and also don’t use AttachTo() 2 lines further down :slight_smile:

And get Visual Assist X :wink:

I think I need to take a nap ;). I removed ALL references to the CameraBoom and so I’m simply left with the following 3 lines (After the GetCharacterMovement() block):



FollowCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("FollowCamera"));
FollowCamera->SetupAttachment(GetMesh(), "headSocket");
FollowCamera->bUsePawnControlRotation = false;

But still the “FollowCamera” is parented to the RootComponent and not to the Mesh.

WHAT"S THE DEAL WITH UNREAL! I ended up closing UE4 and when I reopened, it was fine. FollowCamera was properly under the Mesh. This happens CONSTANTLY in UE and it seems to just be the norm. No product I know of would ever be pushed out with this problem. BTW, I did recompile within the editor as well, previously, and still had that issue.

Thanks for the Visual Assist X tip.

I’ll be honest i never press that compile button in the editor i swear it causes more problems than it solves, i cant remember the details of how it works but it doesnt actually update certain things so you compile and then half the stuff you just coded isnt there :slight_smile:

id rather compile in visual studio and go for a cigarette :wink: