This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

I have a (environment) scene with 77 mesh instance to which i want the player to be able to collide with.
Problem is, how do i automate the process of adding trimesh collision to each and every mesh.

Godot version 3.5
in Engine by (12 points)

1 Answer

+1 vote

3 Steps .....

  1. Use tool mode
  2. Loop through SceneTree
  3. Create collisions


tool extends EditorScript

func _run():
    for child in get_scene().get_children():
        if child is MeshInstance:

The above code assumes a few things like all 77 MeshInstances are a child of the scene root which you can get over by creating a recursive function to get all nodes.

In the Script Editor press File > Run

by (6,942 points)
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 Frequently asked questions and 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 [email protected] with your username.