SpringArm lenght not working properly C++

In my game, I have a camera attached to the SpringArm Component. In constructor I’m setting default TargetArmLength and rotation, but later , when I’m changing ship to a bigger one, I want to change the TargetArm length. The problem is that instead of going up, the camera goes backwards. I would appreciate any help.

if (!CameraSpringArm)
		CameraSpringArm = CreateDefaultSubobject<USpringArmComponent>(TEXT("CameraSpringArm"));
		CameraSpringArm->SetUsingAbsoluteRotation(true); // Don't want arm to rotate when ship does
		CameraSpringArm->TargetArmLength = 1200.f;
		CameraSpringArm->SetRelativeRotation(FRotator(-80.f, 0.f, 0.f));
		CameraSpringArm->bDoCollisionTest = false; // Don't want to pull camera in when it collides with level
void ABasePlayerShip::ChangeShipParams(UStaticMesh* StaticMesh, const float SphereRadius, const float NewGunOffset, const float NewArmLength)
	GunOffset.X = NewGunOffset;
	CameraSpringArm->TargetArmLength = NewArmLength;

I forget whether this works well or not – but, have you tried not using relative rotation when setting it?

No, when I was researching this problem I read that I should remember to have the rotation relative.

When you increase the arm length, it’s supposed to move backwards.

If you want it to go up, you would need to add to the Z component of TargetOffset.

Thank you, that helped.