How to remove a specific object?

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

Exemple: I have many rocks (one is the copy of the other) on my terrain and I want it to queue_free() after i pick the rock. But i want just the selected rock to desappear. How can I do that?

I am working in 3D and the area(body) script of the rock is in the same script of the main scene. In any doubts… hehe

jm4rcos | 2020-05-29 23:19

How do you ‘pick’?

whiteshampoo | 2020-05-30 06:58

queue_free() or visible = false and plus a number to my hud

jm4rcos | 2020-05-30 21:34

How do you detect that it should be removed? What is the code that triggers it?

Becbunzen | 2020-06-02 18:11

if ray.is_colliding():
var target = ray.get_collider()
Its working, but i was trying to use some similar script to play the animation of the target. instead of all animations. because one is a copy of another.

jm4rcos | 2020-06-02 18:48

Hmm, is the problem that you change all the animations when you only want to change one? If so, try to make a the rock a separate scene, make a new instance of the rock in your main scene for every rock, then you can change the animation of each rock separately.

Becbunzen | 2020-06-02 19:05