Work in progress

The content of this page was not yet updated for Godot 4.2 and may be outdated. If you know how to improve this page or you can confirm that it's up to date, feel free to open a pull request.

Using MultiMeshInstance3D

Вступ

In a normal scenario, you would use a MeshInstance3D node to display a 3D mesh like a human model for the main character, but in some cases, you would like to create multiple instances of the same mesh in a scene. You could duplicate the same node multiple times and adjust the transforms manually. This may be a tedious process and the result may look mechanical. Also, this method is not conducive to rapid iterations. MultiMeshInstance3D is one of the possible solutions to this problem.

MultiMeshInstance3D, as the name suggests, creates multiple copies of a MeshInstance over a surface of a specific mesh. An example would be having a tree mesh populate a landscape mesh with trees of random scales and orientations.

Налаштування вузлів

The basic setup requires three nodes: the MultiMeshInstance3D node and two MeshInstance3D nodes.

One node is used as the target, the surface mesh that you want to place multiple meshes on. In the tree example, this would be the landscape.

Інший вузол використовується як джерело, меш, який потрібно дублювати. У прикладі з деревом це буде саме дерево.

In our example, we would use a Node3D node as the root node of the scene. Your scene tree would look like this:

../../_images/multimesh_scene_tree.png

Примітка

Заради простоти цей урок використовує вбудовані примітиви.

Now you have everything ready. Select the MultiMeshInstance3D node and look at the toolbar, you should see an extra button called MultiMesh next to View. Click it and select Populate surface in the dropdown menu. A new window titled Populate MultiMesh will pop up.

../../_images/multimesh_toolbar.png ../../_images/multimesh_settings.png

Параметри MultiMesh

Нижче наведені описи параметрів.

Цільова поверхня

Меш використовується як цільова поверхня, на якій розміщуються копії іншого меша.

Початковий Меш

Меш, який потрібно дублювати на цільовій поверхні.

Вісь вгору сітки

Вісь, яка використовується як вісь вгору для початкового меша.

Випадкове обертання

Випадкове обертання навколо осі вгору початкового меша.

Випадковий нахил

Випадковий загальний нахил початкового меша.

Випадковий масштаб

Випадковий масштаб початкового меша.

Масштаб

Масштаб початкового меша, який буде розміщений над поверхнею цілі.

Кількість

Кількість екземплярів меша, розміщених над цільовою поверхнею.

Виберіть цільову поверхню. У випадку з деревом, це повинен бути вузол ландшафту. Початковим мешом повинен бути вузол дерева. Відрегулюйте інші параметри як вам подобається. Натисніть Populate і кілька копій початкового меша будуть розміщені над цільовою сіткою. Якщо ви задоволені результатом, ви можете видалити екземпляр меша, який використовується як початковий меш.

Кінцевий результат повинен виглядати так:

../../_images/multimesh_result.png

Щоб змінити результат, повторіть попередні кроки з різними параметрами.