Help Needed – Can’t Return Camera to Initial Position After ADS (UE5.6)

Hi everyone,

I’m working on an ADS (Aim Down Sights) system in Unreal Engine 5.6 where the camera smoothly moves between two positions: the default camera position (which follows the player and is attached to a spring arm), and the ADS position (which is a socket location on the weapon). I’m using a Lerp (Transform) to move the camera between these two points, and the aiming part works fine.

The problem is that once I’m done ADSing, I can’t get the camera to return to its original position. It either snaps to the wrong location, detaches from the player, or just doesn’t go back to how it looked before ADS. I’ve tried saving the camera’s initial transform using GetComponentTransform and then using SetWorldTransform or SetRelativeTransform to move it back, but none of these solutions give me the correct result. The camera either ends up in world space (so it no longer follows the player), or in a completely unexpected spot.

Here’s some info about my setup: the camera is a child of a spring arm. I’m only moving the camera, not the spring arm. The ADS target is a socket on the weapon, which is in world space. What I want is for the camera to move to that socket when aiming, and then return to its original position relative to the spring arm after ADS ends.

What’s the best way to store and restore the camera’s initial position while keeping it correctly attached to the player and spring arm? I’d really appreciate any help, suggestions, or blueprint examples.

Thanks in advance!

Why are you setting the transform in world space, rather than relative space?

Also, why isn’t anything plugged into the A in the lerp? (that seems problematic, particularly while operating in world space).

Thx for replying, I really appreciate it!

I was following a tutorial but ran into some issues (Due to project differences).
I tried everything I could think off including relative space, as far as my knowledge goes (I’m relatively new to unreal).

There is nothing plugged into the A part of the lerp at the moment because nothing seems to work, so I decided to leave it out, if that makes sense.

Have you tried changing the position of the parent spring arm, instead of the camera? Issues could arise between parent/child.

Since you are attempting to change the relative location of the camera, as it is a child of an object that will be moving relatively, you should be changing the component’s relative location, not world location. You can convert the socket location from world to local space, then use that to set your relative location. I’d assume rotation is already controlled by player input, so that shouldn’t need to be set - otherwise you can set it to the gun’s rotation. Hopefully this helps!

UKismetMathLibrary::InverseTransformLocation | Unreal Engine 4.27 Documentation | Epic Developer Community

Thanks for your suggestion, I will definitely give it a try!

Thank so much, it works!

1 Like