Center RTS Camera on Zoom Out

It’s definitely not optimal. I’ve spent hours and hours just trying to think of ways to improve the logic but i’m not really sure i follow what you mean i should do?
I’m quite(very) new with blueprint and programming in general, Spent about a month with it on and off.

I’ll try explaining it a bit further:

The first and largest image shows basically the entire function for the “pyramid bounds”.

&d=1494792303

Every section of it is almost identical to the second image IE X+ X- etc.

&d=1494792312

Origin X/Y is the coordinates for the center of the camera view at ground level.
In the last picture where i set the “Move Range” you can see that when i am fully zoomed in the Move Range will be at it’s maximum value which is the entire size of the map
and when it’s fully zoomed out it will be 0 meaning i can’t move at all, Which is exactly as i want it ofcourse.

&d=1494791360

Again in the second image you can see the logic for pushing the Origin/Center of the camera back to within the bounds and i do this for X and Y + both - and X+Y+ etc for the four corners.
So that no matter where i try to go it will always be pushed back correctly.

Which brings me to the real issue with this.
I’m using Lerp to make sure it’s within the bounds the “- 1”(In the second image) is just to make sure i don’t get stuck anywhere since i cant move if im outside of the bounds.
Neither Lerp or FInterp are ideal for this since i have a Move Speed for the camera and if i increase it i can potentially overpower the Lerp/FInterp and force it outside of the bounds.
Initially i tried to make sure i cant move the camera if it’s close enough to the move range in any axis but this only resulted in it being push back and imediatly trying to go outside again and since it’s ticking it just looks extremely choppy.

So i’m really looking for a way i can have it be more rigid. When it’s at the limit where it shoulnt be able to move any more then it should just stop. Perhaps this is just overly complicated and it’d be easier if i learned about using Dot Product as in the link you sent?

I would need major help with doing that i think :slight_smile:

Edit: Added the same images again so it’s easier to follow.
Edit2: Sorry my forum posts are probably more of a disaster than my functions. :stuck_out_tongue:
Edit3: Regarding the Sequence i do know what it does, more of a question if it should be there at all. Since i cant be at X+ and X- at the same time it doesn’t really seem to be a big deal but there’s most likely a better way of doing it.