Hey guys. I've been toying around with this camera system for about an hour and i just can't seem to wrap my head around how to get it to work. So before I drive myself crazy or scrap the idea I thought I'd post here and see if some more intelligent folk could help me out.
I have a large scene (larger than the screen size) and I'm trying to enable a click and drag camera system. So when you click the mouse on the map and drag left, the camera moves to the right, not unlike navigating a mobile device. Basically wherever the mouse clicks should feel like it's holding the map and moving it's position about. I don't need any sort of momentum on it so the camera can stop moving the instant the mouse button is released.
Currently I'm using an actor I'm calling CameraController which spawns in the center of the screen position using X and Y mouse + camera x and y position. Then on that actor I'm using When Updating that checks if the mouse is down and setting the x and y position of the actor to (And this is the part I'm wrong) x of mouse - screen width and y of mouse - screen height. Now, the dragging to move thing works perfect. If I click and drag the camera moves exactly right and is very smooth.
The issue is that every time I click it takes my camera back to the top left of the map each time. I can't seem to figure out how to prevent this from happening. I've tried adding the x and y of camera to the x and y of mouse, but that causes worse issues of the screen jumping around like crazy.
Any ideas?