Camera's setup attachment problem

The code I wrote in C++ is not reflected in the Blueprint for some reason I can not understand. Let me say it very simply that the camera is not attached to the component I want to attach.

	ArmsComp= CreateDefaultSubobject<USkeletalMeshComponent(TEXT("AnimatingArms"));

	CameraComp = CreateDefaultSubobject<UCameraComponent(TEXT("InteractionCamera");
	CameraComp ->SetupAttachment(ArmsComp, "CameraJoint");
	CameraComp ->SetRelativeRotation(FRotator(90.0f, 90.0f, 0.0f));
	CameraComp ->SetAutoActivate(false);
	CameraComp ->SetActive(false);

Even the rotation information that I am trying to set is not reflected.


When you assign the animation to the skeletal mesh, the camera also needs to change position with the skeletal mesh, which was actually the case and it broke for some reason I couldn’t find.
Has anyone had such a problem?

I see you are using an invisible skeletal mesh component.

Make sure this setting is set to “Always Tick Pose And Refresh Bones”, otherwise socket and attached components transforms are not updated.

1 Like

Thanks for the answer but it is already set like this.

Show the .h file, and you should create these all components under a static function and call that function under constructor, this way you will have a clean constructor with more understable code to figure out what you are doing.

hope it helps, cheers!

Actually I tried to include these codes in a static function and call the method in constructor, unfortunately no different action happened.
Your advice is of course good for clean coding.

I noticed that the rotation values ​​that appear there mean the same angles, even though they look different than in the code. So for some unknown reason, the same rotation is assigned with different values.