Hello,

I've bee having difficulty detecting scrolling behaviour on my rts camera script. I'm trying to get anything in the following example to print.

extends Camera

func _input(event):
	if (event is InputEventScreenDrag):
		print("screen drag (event)")
	if event is InputEventMouseButton:
		if event.is_pressed():
			if event.button_index == BUTTON_WHEEL_UP:
				print("wheel up (event)")
			if event.button_index == BUTTON_WHEEL_DOWN:
				print("wheel down (event)")

func _process(delta):
	var zoom_in = Input.is_action_pressed("zoom_in")
	var zoom_out = Input.is_action_pressed("zoom_out")

	if zoom_in:
		print("zoom in (event)")
	if zoom_out:
		print("zoom out (event)")

Even though I am receiving input events none of them match the act of scrolling up or down on the trackpad.

After digging in to it a little bit what I'm looking for was:

func _input(event):
	if event is InputEventPanGesture:
		print("scrolled: " + str(event.delta.y))
4 years later