I assume you want something like an RTS style camera? I have a working prototype but im not so good in explaining. Well who cares, lets give it a try :).
This may look a bit overwhelming for you, but you get an working example and i personaly prefere to lern by reverse engineering other stuff. So lets get started:
I split my camera system in two parts:
- camera controller (used for screen border calculation and click events)
- camera pawn (placed in the level and is moving the camera around)
- Camera Controller
All required Variables should be visible in the picture, you don’t need “KlickPosition”, “SelectedMinion” and the Zoom related Stuff
“Get ScreenUpDown” and “Get ScreenLeftRight” are Inputs i asignt to the arrow keys. My camera can be moved by either using the arrow keys or by moving the cursor to the edge of the screen
For that i came up with the function “Get Mouse Scroll Input” (Pure function):
“Mouse Scroll Threshhold” should be set to 0.1 -> This will determine how close the mouse has to be near the edge to start moving.
- Camera Pawn - This is a Bluprint with type “Pawn” i has a scene component, a spring arm and a camera
It has nothing under Event Graph. Just one function called “Scroll Screen”. Thats the one we use in the Camera Controller
The 4 Camborder Variables determine how far i can move the camera away from the center of the map.
The SpringArm and the camera a set so they above the pawn and look straight downwards.
You can ignore the Zoom related stuff here too.
Give it a try - i hope it will work for you.