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.
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)