Turn off collisions for all children of a node (gdScript)

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

What I’m trying to do:
Let’s say I have a Node2D with a bunch of StaticBodies, each having own collision shapes. Can I turn off collisions (for example by disabling collision layers/masks) for all children of said Node2D using gdScript, without listing all of those StaticBodies in code?

This is just an example, what I am trying to do just requires disabling a lot of collisions at once.

:bust_in_silhouette: Reply From: MysteryGM

Can I turn off collisions (for example by disabling collision layers/masks) for all children of said Node2D using gdScript, without listing all of those StaticBodies in code?

You want groups: Scripting (continued) — Godot Engine (3.0) documentation in English

Just change the layer masks of the group. I don’t know if it is possible to have no layer or index, but I know you can change them.