Make a Collider inside another Collider clickable?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By DKesserich
:warning: Old Version Published before Godot 3 was released.

Is there a way in 3D to make a collider that exists inside a different collider still be clickable when the camera is outside the larger collider?

For example:
If I have a 1 meter cube with a box collider that’s the same size, but it’s inside a 10 meter sphere that has a 10 meter box collider, and I want it so when I double-click on the sphere the visibility of the cube changes, and when the cube is visible and I click directly on it the cube registers the click event instead of the sphere.

Do I have to do this all with raycasts, or is there an easier way?

I was able to figure out getting the collision with a raycast. My trouble now is figuring out how to send an input event to the object that is returned by the raycast.

I’ve tried

find_node(collisions["collider"].get_name())._input_event(event stuff here)

and I get a “Nonexistent function '_input_event' in base Area” error. Is _input_event a private function or something? The documentation for CollisionObject doesn’t say anything about that. What am I doing wrong?

DKesserich | 2017-12-15 23:42

:bust_in_silhouette: Reply From: DKesserich

Figured it out.

Needed to add a script to the object with the _input_event function, and that function just has to call emit_signal("input_event",camera, event, click_position,click_normal,shape_idx) to do what I wanted it to do.