zoom out when moving

Hello,

I’m a newbie with unreal engine, and dev.

I’ve started with the 3d side scroller asset. I’ve managed to make the camera zoom out by changing the value of springarm1 when I press a key. But what I really want to do, is change this value when my character is moving. I tried many ways, but nothing. For the moment my blueprint looks like this.

Thank you in advance

You have the right idea, but there are a few problems with your code.

First, you shouldn’t be using a while loop. While (and for) loops are meant for running code multiple times depending on a condition. Instead, you want to run your code once for each frame. Though this is possible to do using loops and delays, it is significantly easier and better to use the built-in tick event.

Second, you are setting the target arm length based on the current target arm length. This means that every time the code is run (every frame) the arm length will be multiplied by 200. Instead, you should set the length based on values unaffected by this bit of code. For example, you could use ‘select’ with Is Walking plugged into the index, values of 200 for true and 100 for false, then set the target arm length to the output of that select.

Thirdly (extra) this would lead your camera length to change instantly. To smooth it out, you could use lerp to interpolate between the current target arm length and the output of your select (the ‘target’ target arm length) with an alpha of delta seconds (from tick)

This will do it:

Thank you for the answer, and explications.

Like I said. I’m a newbie.
I already have ‘event tick’ and ‘event beginplay’ in my BP sidescrollercharacter > event graph, for camera lag script,

so, I tried this

,but nothing.

And I can’t find the box ‘I=’.

Edit : finally I found (enum>not equal)

Pull and pin out and type ! ( it’s != )

Finally, I used your BP ClockworkOcean, thanks you. I saw there is a lag otion integred into springarm1.

Now I need to put a delay before the zoom out and zoom in.