How to build fast tree node with inherited transform values from parent node

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


Problem description

I am looking for a fast way to make my world be alive. This is simple electric substation model gained from BlenderBIM addon. I transferred it to GODOT with some workaround and now my model is consist of multiple objects which is MeshInstances, which is really cool:

Importing of the glb file divide every element from this substation to MeshInstances Nodes:

There are couple thousands of similar nodes. My VR mechanics is working very good. However, those nodes are invisible for my walking mechanics which is not good. In other words i can walk through every element. I know that i have to build a simple node family for every element with the same volume/surface and transformation values or maybe i need to switch those MeshInstances to another kind of node e.g. StaticBody

Purpose of the question

Is there a fast way to make mentioned families for each node. I am imagine that there should be simple GDscript code line what will build those families for every element, but i am not pro in scripting with this. Thank you for any informations

:bust_in_silhouette: Reply From: Wakatta

Right on the money.

The words you were looking for are tool script. Basically you loop through all children meshinstance nodes and add the collision data and static body through script.

tool extends EditorScript

func _run():
    var parent = get_scene().find_node("ModelStackji")
    for child in parent.get_children():
        if child is Meshinstance:

In the script editor simply click file>run

Yee. Thank you it works :slight_smile:

g3nkoV | 2021-09-29 21:12