I'm still using Godot 2.1.4 because of GLES2 not being in GODOT3
I want to drag across the screen to pan the camera and limit the camera not to pan to far. This is what I've got:
var p = get_node("Camera").get_pos()
var pan = current_pan_move * pan_rate
p.x = clamp(p.x + pan, -150, 150)
This obviously only pan the x axis, and no matter what I add, i can't pan the x and y axis at the same time. I did use this code to pan and use the camera limit to prevent the camera from scrolling too far:
if event.type == InputEvent.MOUSE_MOTION:
But this was a nightmare, it messed with my zoom(didn't zoom to the center of my scene anymore, couldn't fix it) and the camera got stuck whenever it reached the pan limit.
How can my first code be edited to allow the camera to pan on x and y axis?
If you have better way to pan the camera with SCREEN_DRAG and I will appreciate it.