Trying to capture scroll on macbook

KequcKequc Posts: 114Member


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.

Tags :


  • KequcKequc Posts: 114Member

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

    func _input(event):
        if event is InputEventPanGesture:
            print("scrolled: " + str(

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file