Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | mronetwo | |
Old Version | Published before Godot 3 was released. |
Hi, I have stumbled on something that I can’t figure out.
The situation is as follows: I’ve got a scene inheriting from DAE file. It has some parenting in it (some objects are parents for others). I also create collision meshes by modelling them in Blender and appending -colonly to the name. I try to pick those objects with mouse clicking on them. I use input_event
signal from StaticBody node. The signal returns the index of the collision object user clicked on (shape_idx). But for me it always returns 0 no matter on which object I click.
Here is the image that shows the nodes in the scene. There are two StaticBodies with collision shapes. I connect them to the method which handles clicking like so:
if N is StaticBody:
N.connect("input_event", self, "clicked_on", [])
And handle the clicking with:
func clicked_on(camera, event, click_position, click_normal, shape_idx):
if event is InputEventMouse:
if event is InputEventMouseButton:
if event.is_action_pressed('mouse_lmb'):
print('clicked on me: ' + str(shape_idx))
I click on one and it prints ‘clicked on me: 0’. I click on the second one the same happens. What am I missing?