How to touch specific mesh (rigid object) in godot 3.x ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By GameVisitor

Hi all,

The following code used to work perfectly in Godot 2.1 but I can’t seem to find the alternative way to do it in Godot 3.x:

    extends RigidBody
    #-------------------------------------------------------------
    func _ready():
    	# Called every time the node is added to the scene.
    	# Initialization here
    	set_process(true)
    	pass
    #-------------------------------------------------------------
    func _input_event(camera, event, pos, normal, shape):
    	if (event.type==InputEvent.MOUSE_BUTTON and event.pressed):
    		print("Object touched !")
    	pass
    #-------------------------------------------------------------

In both case the rigid object has a mesh and collision shape as child.

PS: I don’t want to detect a generic touch screen event but exactly when this mesh is touched.

Thx in advance.

The following code is working in godot3.x in another test scene but not in the main scene :frowning:

extends RigidBody

func _ready():
    # Called every time the node is added to the scene.
    # Initialization here
    set_process(true)
    pass
#-------------------------------------------------------------
func _input_event(camera, event, pos, normal, shape):
	if (event is InputEventMouseButton and event.is_pressed() == true):
		var parentName = get_parent().name
		print("Object touched :" + parentName)
	pass

Seems like the event is not propagated to the sub (initiated) scene ?

GameVisitor | 2018-06-03 16:52