使用多网格实例

简介

In a normal scenario, you would use a MeshInstance 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. MultiMeshInstance is one of the possible solutions to this problem.

MultiMeshInstance,顾名思义,在特定网格的表面上创建MeshInstance的多个副本。 一个示例是树形网格用随机比例和方向的树填充景观网格。

设置节点

基本设置需要三个节点:MultiMeshInstance节点和两个MeshInstance节点。

一个节点用作目标,即要放置多个网格的网格。 在树的示例中,这将是景观。

The other node is used as the source, the mesh that you want to have duplicated. In the tree case, this would be the tree itself.

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

../../_images/multimesh_scene_tree.png

注解

For simplicity's sake, this tutorial uses built-in primitives.

现在您准备好了一切。 选择MultiMeshInstance节点并查看工具栏,您应该在 View 旁边看到一个名为 MultiMesh 的额外按钮。 单击它并在下拉菜单中选择 填充曲面 。 将弹出一个名为* Populate MultiMesh *的新窗口。

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

MultiMesh设置

以下是选项说明。

目标表面

The mesh used as the target surface on which to place copies of your source mesh.

源网格

要在目标曲面上复制的网格。

网格向上轴

轴用作源网格的上轴。

随机旋转

Randomizing the rotation around the up axis of the source mesh.

随机砖块

随机化源网格的整体旋转。

随机缩放

随机化源网格的比例。

Scale(大小)

将放置在目标曲面上的源网格的比例。

放置在目标曲面上的网格实例数量。

选择目标曲面。 在树情况下,这应该是横向节点。 源网格应该是树节点。 根据您的喜好调整其他参数。 按 Populate ,源网格的多个副本将放在目标网格上。 如果对结果满意,可以删除用作源网格的网格实例。

最终结果应如下所示:

../../_images/multimesh_result.png

To change the result, repeat the previous steps with different parameters.