How to get a consistent offset on a zooming camera

My screen is split between a “playable” area and a “text” area. I want to be able to click a location in the playable area and have the spring arm/camera be able to pivot around and zoom in on it. Adding an offset to the camera semi-works, but when zooming the object is moved off centre. How can I set up the camera to stay centred on the selected location (relative to the playable area) even when zooming?

Zoomed Out (correct):

Zoomed In (off centre):

you can try have the camera rotate a small angle and when you zoom in, don’t change the camera FOV, but shorten the spring arm. I hope it works.

Hi, did you find a solution to the problem?

I was trying by adding an additional offset = sin(atan(object size/spring arm length))x arm length. but it doesn’t work, it just multiply how much faster it goes offset but can’t solve the real problem that is move the center to the side.

Now I will try using a “screen capture component 2d”

Solved!

I found 2 solutions:

the screen capture works but heavy expense in resources and frame rate, any case is accurate it moves the perspective center to the area you need so no only your zoom is consistent but also the perspective is centered in your zoom. Option A

if you prefer to do no waste resources the best is adding an variable offset to the camera, the zoom is consistent but the perspective center will still on the screen center. (for me is ok) Option B

Now how to do: Option A

you add to your pawn camera the screen capture component, as a target you create a render target texture (with resolution your screen size + 2xdisplacement) so is you want to move the center about 400 pixels and you have a 1920x1080 screen resolution you will need it with 2720x1080. and yes you will get an alert about this size is to big.

after you use this texture in a widget, as an image with anchors in the 4 corners and -800 left alignment. for me it drops from over 120 to 94 fps.

Option B:

ok, this is more tricky first we create the offset in one function and second we modify it in a second function to zooming

create the offset function:

create a variable with the spring arm length (original length)

create a new variable with the spring arm length (actual length)

create a integer variable (offset amount) [for me i’m using values about 200 but depends on the size of your scene]

divide offset amount by original length

calculate atang(degrees) of this value

calculate the sin(degrees) of the result

multiply by actual length

modify offset for zoom function

where you are doing the zoom at a set offset and feed it with this:

original length/actual length

divide the offset amount by the result before

calculate the atan

with this calculate the sin

multiply by actual length

is done! just a little of trigonometrics!!

Geverk, Could you please show an example in blueprints?

From what I have seen in out game, this does nothing…

My Attempt:

Wish we could find a good solution for maintaining the exact look location of the crosshair while zooming in, Rather than it moving over to a new spot.

Hi, this is the latest version we used in our project, here we have no more problems as described before.

I have a few versions according different kinds of inputs, but this base can be use for all.