How do I make C++ third person template have the first person perspective.

This is a video of the method I use when making blueprint projects: How to make a true first person camera but I have just switched to C++ to make the multiplayer features of my game and when I try to change the camera in the components tab it says these objects are inherited and cannot be moved.

When creating the camera component, you should add EditAnywhere and BlueprintReadWrite in the parentheses of the UPROPERTY()

I am so happy for the quick reply but when I change the code to this it doesd not work

/** Camera boom positioning the camera behind the character /
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Camera, meta = (AllowPrivateAccess = “true”))
USpringArmComponent
CameraBoom;

/** Follow camera /
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Camera, meta = (AllowPrivateAccess = “true”))
UCameraComponent
FollowCamera;

Oh wait I assumed it was a blueprint access issue but reading your original post once again, now I see that you’re actually trying to edit an inherited component.

I couldn’t connect that to your objective though. Could you expand on the steps you took to get there? Maybe I’m misunderstanding something but to adjust the camera transform to your liking from the viewport, you just gotta create a new C++ based character class, add the camera component to it the way I explained, and play with the positioning either by changing the defaults or changing during runtime.

I created a new C++ Project using the third person template and am now trying to parent the camera too the character mesh rather than the camera boom however when I attempt this it says. This component is inherited and cannot be reordered. I can move the camera in the viewport but I cannot parent it to the mesh in the components tab. I hope this provides some clarification. Thanks!

How would I go about parenting the camera to the mesh in the header file of the character class?

Hey @LunarX, so all you need to do in order to attach your camera component to the mesh are the following.

Header:

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	UCameraComponent* Camera;

Cpp:

	Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"));
	Camera->SetupAttachment(GetMesh());

When you attach it to the mesh, it’s transform will be based on the mesh’s orientation so you can just go ahead and position it to your liking from the viewport afterwards.

The camera is no longer parented to the camera boom however it is still not parenting to the mesh. Here are some screeenshots:
Screenshot 2025-01-04 190921
Screenshot 2025-01-04 190938

The camera won’t parent to the mesh.

Try closing the editor and building the project via VS

Thank you so much! It finally worked after a good day of bashing my head over the camera not parenting to the mesh. You are a life saver.

1 Like