0 votes

Hello!

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:
Substation model
Importing of the glb file divide every element from this substation to MeshInstances Nodes:
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

Godot version 3.3 stable
in Engine by (17 points)
edited by

1 Answer

+1 vote
Best answer

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.

Game.gd

tool extends EditorScript

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

In the script editor simply click file>run

by (4,480 points)
selected by

Yee. Thank you it works :)

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.
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 webmaster@godotengine.org with your username.