This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

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?

in Engine by (31 points)

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?

1 Answer

0 votes

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.

by (31 points)
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 Frequently asked questions and 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 [email protected] with your username.