0 votes

I tried to make a script that detects the collided object groups and then if the collided object is in the Wall group it's queue_free() but i wasn't success on that
I also tried to make it in visual script but that's another story

my GDscript function is:

func _on_Area_body_entered(body):
    if is_in_group("Wall"):

what could have gone wrong?

asked Mar 16 in Engine by Giannis1996 (65 points)

1 Answer

+1 vote
Best answer
func _on_Area_body_entered(body):
    if is_in_group("Wall"):

Here, is_in_group("Wall") will check if the node holding this script is inside the Wall group. It does not use the body parameter at all.

But if you change it like this:

func _on_Area_body_entered(body):
    if body.is_in_group("Wall"):

This will check if the colliding body is inside the Wall group. Choose the one you need.

answered Mar 16 by Zylann (27,004 points)
selected Mar 16 by Giannis1996

It worked!!
Thank you so much!

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 How to use this Q&A? before posting your first questions.