0 votes
     func render_content_inventory():
        ...
        for slot in slots:
            ...
            if (Inventory.get_data(slot.index)):
                var kinematic_body = KinematicBody2D.new()
                kinematic_body.set_name('kinematic_item_slot_'+str(slot.index))
                kinematic_body.set_global_position(Vector2(20,100))
                kinematic_body.set_pickable(true)
                var collision = render_collision_shape(
                    'collision_item_slot_'+str(slot.index),
                    {'x': 0 - style.width_2 * 0.8 / 2, 'y': 0},
                    {'width': style.width_2 * 0.8, 'height': style.height_4 * 0.8}
                )
                kinematic_body.add_child(collision)
                $window_inventory.add_child(kinematic_body)
            if $window_inventory.get_node('kinematic_item_slot_'+str(slot.index)):
                $window_inventory.get_node('kinematic_item_slot_0').connect("input_event",self,"on_input_event")

func on_input_event(viewport, event, shape_idx):
    print('hover in')
    if event is InputEventMouseButton:
        if event.button_index == BUTTON_LEFT and event.pressed:
            emit_signal("dragsignal")
        elif event.button_index == BUTTON_LEFT and !event.pressed:
            emit_signal("dragsignal")
    elif event is InputEventScreenTouch:
        if event.pressed and event.get_index() == 0:
            self.position = event.get_position()

https://ibb.co/nzzz20x

its only trigger when I hover outside PopupDialog

Godot version v3.2.3.stable.official
in Engine by (12 points)

Your KinematicBody2D has a collisionobject2d (the blue thing), right? I'm not sure what's going on exactly, but it needs to collide with another CollisionObject2d for an event to trigger or physics to simulate. And from what I see in the image, there is no 2nd CollisionObject2d to collide with.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.