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!