How to: Simple Camera Zoom w/ Mouse Wheel

I’m new to all and it took me about 3 hours to actually figure out how to go about getting my camera to zoom in/out. So to save all the other newbies out there the trouble here is the blueprint prototype i set up, hope it helps :slight_smile:

http://s4.postimg.org/wcybtepdp/Mouse_Zoom.jpg

To zoom out you would just add to the Target Arm Length

Nice. Here is an alternate way.

By the way…you can get smooth transitions using Event Tick + FInterpTo node.

3 Likes

YAWTZTC (Yet Another Way To Zoom The Camera)

setup works with several cameras, just make sure you have the correct one assigned to current Camera. The Zoom inputs are mapped to actions that use MouseWheel and the factors are 1.1 for zoom out and 0.9 for zoom in.

EDIT: Forgot to mention I keep my view target at 0,0,0.

2 Likes

I was able to get mouse clicking functionality working but scrollwheel isn’t working for me.
MouseScroll Up/Down isn’t registering. Even added a print string just to make sure it wasn’t my blueprint setup. Am I forgetting to check some box to activate Mouse Scroll Functionality?

i see yesterday that tut

Edit > Project Settings > Engine > Input, you have 2 Action Mappings, one called ZoomIn with Mouse Wheel Up and one called ZoomOut with Mouse Wheel Down? If you need to add them, don’t forget to click the “Set As Default” button.

yeah I only added those just to see if for some reason I needed to add it to work. So after further tests, the inputs that I’m pressing are only being done when I place them in the PlayerController blueprint I’m using.

So when I try to execute a mouse click, scroll up, scroll down, etc., they are only executed if I put them in the player controller. is a bit of problem since I don’t know how to gain access to the camera of the character I’m controlling with the spring arm from PlayerController blueprint.

Can you elaborate on how to set that up?

How do we do pinch to zoom in/out?

Having the same problem, could anyone elaborate on ?

Bump! Anyone?

Here’s what I have so far, I just need smoothing -


Here you go guys. is using a Camera Boom. We set the fact the player wants to change the zoom level to a variable “GoalArmLength” and then on Event Tick use FinterpTo to actually set the length nice a smooth. is not clean but it works.

Hello, I cleaned up your BP a bit and worked with a clamp instead of < and >, much neater in my opinion :wink:
Here’s a screenshot, much thanks to you for the idea tho! Might update it with a nicer curve (like the further you zoom in the bigger the sensitivity and vice versa)

attractive approach, I’d like to add an important factor to it… when you zoom in too close you will be actually looking at the character (as*) haha … !! so we can make a good use of the camera arm socket offset (Z) to be increased and decreased side by side with the arm length using the same methods here before… that will make the camera diagonally zoom to the head position which is natural and right instead of … lol :smiley:

Make a couple of sockets on the character mesh to hold the cameras positions of where you want it when it is zoomed in and out all the way. Have the camera, when it is zooming in and out, move to those positions. That way you can move the zoomed-in camera’s socket to their arm, their head or even their …well, you get the point.

I improved upon the camera scroll blueprint.

Explanation: The camera will now slow down when it reaches its maximum or minimum height, resulting in an even smoother camera movement. Also, I added a check to see if the “Goal Arm Length” needs to be recalculated. results in the calculation only occurring when it’s needed.

Anyone know how to implement zoom under mouse cursor or zoom under a screen position ? like when zoom in object under the mouse will stay still like Clash of Clan or Boom Beach style camera zoom.

You need:
Location of mouse in world space. (MWSL)
Pawn location. (PAWN)
Spring Arm; Arm length (AL)
Spring Arm; Starting Arm length (SAL)

Set pawn location, when you set new spring arm arm length, to L= (((MWSL-PAWN)/SAL)*(SAL-AL))+PAWN

thanks but is work on orthographic camera ?

@tahmidk15

Hey tahmidk15. I’m sure you already figured it out, but 'll definitely work work ortho.

Instead of setting the length of the “Spring Arm” the camera is attached to, you set the “Ortho Width” property of the “camera” directly.