I am trying to make a camera that you can drag around to pan around an area. In my current implementation, the movement is very choppy and not very accurate or responsive.
The _input(event) is used to start and stop the drag, and the _process(delta) is supposed to keep track of the mouse movement on a frame-by-frame basis.
Any help is appreciated.
var LastMouseCoords = get_global_mouse_position()
var CurrentMouseCoords = LastMouseCoords
var dragState = false
onready var cam = get_node("Camera2D")
CurrentMouseCoords = get_global_mouse_position()
var diff = LastMouseCoords - CurrentMouseCoords
LastMouseCoords = CurrentMouseCoords
if event is InputEventMouseButton and event.button_index == BUTTON_RIGHT:
if not dragState:
dragState = true
dragState = false