Target Arm length doesn't work

Hi everyone,

I’ve stumbled across something I can’t wrap my head around:
I want my camera to zoom in and out via the mouse wheel. This should be a fairly easy thing to do; create a spring arm, attach your camera to it and then change the length of the target arm as necessary. Basic stuff, and I’ve done it in the past a few times.
Well, now it doesn’t work anymore.

226264-ue4-bug-03.jpg

As seen in the second image, the length of the arm does indeed change, but the camera doesn’t move accordingly to it. Even weirder: If I change any other parameter - rotation, position, fov of the camera… - those changes work perfectly fine. The only thing that doesn’t seem to have any effect whatsoever seems to be the target arm length, which decidedly doesn’t make any sense to me.

Did I forget anything essentially to make this work or is there any work around?

Thank you in advance for your replies!

One explanation could be that the springarm’s length is being set on Tick someplace else. Instead of printing it in this function, print the length in the Pawn’s (or whatever object it’s attached to) Tick and observe the value.

Thank you for your response!
It didn’t actually solve my problem, but pushed me into more weird stuff that didn’t work. I migrated my work into a new project, and now it works. It seems like there was something broken with the project itself.
Thank you nonetheless! :slight_smile:

Cool, glad to hear you got it working.

This problem may be caused by collision test, unchecking “Do Collision Test” in SpringArm’s details and try again.

238321-ue4.jpg

8 Likes

I had similar problem. This happened after I create new game mode and new game state. Problem was I used just gamestate instead gamestatebase. After applying gamestatebase problem is gone. Absolutely have no idea how conect spring arm and game state but it works for me.

Oh god, thank you so much. I had the exact same problem, and was due to the Game state. Don`t know why, but thank you so much man.

1 Like

Thank you. This was my issue as well. I had “Do Collision Test” set to true. This option, according to the tooltip, is used to prevent the camera from clipping into the level. The spring arm appeared correct in the Blueprint Viewport tab and it worked fine when its actor was in a different level with a sky sphere in it, but it stopped working after I placed it in a new completely empty level (the arm length appeared to be locked to the bounds of the static mesh in my actor and could not be made to extend farther than that even though in the Blueprint Viewport it was shown correctly).

I’m guessing that the engine uses geometry in a level to determine its extents and since a completely empty level has no geometry in it (aside from a mesh in the actor itself), the spring arm will lock its arm length to the extents of the mesh on the actor.

This wasn’t very intuitive as one would imagine an empty level as having no extents and thus no limit or bounds to restrict a spring arm to, but I suppose this was done for performance or some other underlying architectural/technical reason that I’m not privy to.

Either way, Thank you again zmcdn for this tip and I hope my findings help someone else as well.

I have the same issue, after I mess around few hours I find that camera mode was the cause, I changed camera setting-projection mode from orthographic to perspective in camera component to fixed this issue.

For some reason this fixes the problem, but if you look into third person template (UE 5.01) you notice they have the collision test switched on, and also no special settings in the parent CapsuleComponent. Weird.

this solved my issue. Thank you!

The issue for me was “Do Collision Test” in the Springarm’s details. unchecking that fixed it. weird problem

1 Like

I had a similar issue where the 3PP cam would appear at the Actor origin. Turns out in my C++ I forgot to attach the 3PP cam to the SpringArmComponent socket:

// Create the arm on which the 3PP camera will sit
	ThirdPersonCameraArmComponent = CreateDefaultSubobject<USpringArmComponent>(TEXT("ThirdPersonCameraArm"));
	ThirdPersonCameraArmComponent->SetupAttachment(GetCapsuleComponent());
	ThirdPersonCameraArmComponent->SetRelativeLocation(FVector(0.f, 0.f, BaseEyeHeight));
	ThirdPersonCameraArmComponent->SetRelativeRotation(FRotator(-20.f, 0.f, 0.f));
	ThirdPersonCameraArmComponent->bUsePawnControlRotation = false;
	ThirdPersonCameraArmComponent->TargetArmLength = CamArmLengthMax;

	// Create a CameraComponent	for third person perspective
	ThirdPersonCameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("ThirdPersonCamera"));
	ThirdPersonCameraComponent->SetupAttachment(ThirdPersonCameraArmComponent, USpringArmComponent::SocketName); // I forgot the SocketName here
	ThirdPersonCameraComponent->SetActive(false);

which is necessary to get the arm length offset to be respected. After recompiling I found the issue wasn’t fixed, but I was able to fix it by deleting the instance of the relevant Actor from my map and recreating it; something something CDO I guess, since the code above is in the Actor’s constructor.

If possibly using Orthographic view, spring arm length has no effect. You need to set the Orthographic width to see the visual change.

Thank you friend :slight_smile: