Relative location and rotation of Camera on Blueprint doesn't match the one showed on level editor

Hi, I am new to Unreal C++ programming and UE4 Editor, When I modify the location and rotation of my second charcater camera on Blueprint Editor, I found the location and rotation mismatch when I switch change back to level editor view.
Here is the header code:

UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Camera")
	UCameraComponent* FirstPersonCameraComponent;

Here is the cpp code:

	FirstPersonCameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("FirstPersonCamera"));
	FirstPersonCameraComponent->SetRelativeRotation(FRotator(-265.0f, -70.0f, 60.0f));
	FirstPersonCameraComponent->SetRelativeLocation(FVector(-2, 1, -80.0f));
	FirstPersonCameraComponent->SetupAttachment(Mesh3PComponent);

And then in Blueprint Editor, move the camera to character head, click the compile and save, finally go back to Level Editor, find out the relative location and rotation between the 2rd camera and character doesn’t match.

As you can see, the 2rd camera was attached to character head in blueprint editor, but now it goes above the character head in level view. Does anyone know how to solve this issue?Thanks.

I think you have bad management of components and you should use only one camera for both 1st and 3rd person, transform the location/rotation when you switch to 1st person and restore when you switch to 3rd person… use timeline for the animation to make it smooth while switching and bp readonly things can’t be modify using bp…

Try this

UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Camera")
	UCameraComponent* FirstPersonCameraComponent;
1 Like

Thanks for the tip, I will give it a try.

1 Like