Modelviewer Zoom function

Hi!

I am building a model viewer in Unreal and I am trying to create a function for zooming in and out with the right mouse button (similar to how zooming works in Maya). At the moment I have a function for zooming on the scrollwheel that works like this:

It is basically a pawn with a spring arm and a camera attached to it as components. This is how far I have gotten in translating the zoom to the right mouse button:

The problem is that it does not only move the camera or increase/decrease the length of the spring arm but instead moves the pawn, which means that the zoom creates new focus points in the scene when used. I can´t seem to attach the spring arm or the camera as a target in the LocalTransform. How can I sort this out?

Your altering the transform of the pawn which essentially means it will move the location of the pawn with your setup. Why don’t you instead just alter the spring arm length like you do with the mouse scroll? Basically the Axis Value that Mouse Y is returning is in range 1.0 to -1.0 (if you have not defined otherwise). So just delete the make transform and add the result of zoom speed * axis value to the spring arm target arm length and it will move it closer/further when you hold the mouse button and move the mouse. I don’t have editor here so I could show you the setup but basically you got the pieces you need to solve the case when you combine parts of the first image to the latter image. :slight_smile:

kreivi_krapula: Thanks a million for your help! I had tried your solution before but instead of adding/detracting from the spring arm, I was setting it. I managed to solve it now with your help, this is my solution if anybody else run into the same problem. It also has clamp for max and min zoom built in.

Great. Glad you got it figured out. :slight_smile:
If you feel adventurous you could also check out Lerp to make the zooming effect transition smoothly. :wink:

Hi… Created a plugin for smooth camera functions… Check out the forum link here… Only two nodes needed!

teak