How to get a consistent offset on a zooming camera

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!!