![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | PerriDev |
So i have a node that had a rigid body (clickable).
i used _input_event on the kinematicBody2d, so i expect that if i use _unhandled_input in another object it shouldn’t be triggered if the action is on the Kinematicbody. Am i wrong ?
This is the code of the rigidbody2d component:
extends KinematicBody2D
signal clicked(node)
func _input_event(Obj, event, i):
if Input.is_action_just_pressed("Click"):
emit_signal("clicked", self)
pass
the code in the component that is “watching” the node is:
func _unhandled_input(event):
if Input.is_action_just_pressed("Click"):
var pos = tilemap.world_to_map(get_global_mouse_position())
print(pos)
pass
I think you need to set the input as handled to stop it propagating to the next input handler, something like SceneTree.set_input_as_handled()
. See Using InputEvent — Godot Engine (stable) documentation in English
SteveSmith | 2023-01-01 12:57