Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

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): alt text Zoomed In (off centre): alt text

Product Version: UE 4.17
more ▼

asked Mar 05 '18 at 11:33 AM in Blueprint Scripting

avatar image

151 3 12 19

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

alt textalt textalt textyou 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.

1st.png (666.1 kB)
2nd.png (746.5 kB)
3rd.png (330.6 kB)
more ▼

answered Mar 05 '18 at 07:13 PM

avatar image

55 8 12 16

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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"

more ▼

answered Nov 23 '18 at 05:31 AM

avatar image

36 1 10 8

avatar image geverk Nov 23 '18 at 08:10 AM


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

avatar image Raptagon Studios Jan 04 '19 at 06:57 PM

Geverk, Could you please show an example in blueprints?

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

My Attempt: alt text

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.

bp-attempt.png (156.6 kB)
avatar image geverk Jan 07 '19 at 04:18 AM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question