The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

I have a 3D object with many Area Nodes with each having a Collision Shape as a child.
When I click in the area and trigger an input_event. How do I get the Collision Shape Node that is the child of the Area node i clicked on, so that I could add a child to it?

Godot version V3.5.1
in Engine by (12 points)

1 Answer

0 votes

If the CollisionShape is the only child:

area.get_child(0)

If not:

area.get_node("path")

You could also set a variable for the CollisionShape in your Area script:

onready var collision_shape = $CollisionShape

...and then you could just use area.collision_shape when you need to get the child.

by (104 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.