Node type customization using name suffixes

很多时候,编辑场景时,导出后需要完成一些常见任务:

  • 向对象添加碰撞检测。

  • 将对象设置为导航网格。

  • Deleting nodes that are not used in the game engine (like specific lights used for modeling).

To simplify this workflow, Godot offers several suffixes that can be added to the names of the objects in your 3D modeling software. When imported, Godot will detect suffixes in object names and will perform actions automatically.

警告

All the suffixes described below are case-sensitive.

删除节点(-noimp)

无论是什么类型的节点,具有 -noimp 后缀的对象都会在导入时被移除,不会出现在导入后的场景中。

This is equivalent to enabling Skip Import for a node in the Advanced Import Settings dialog.

创建碰撞体(-col、-convcol、-colonly、-convcolonly)

-col 选项只作用于网格物体. 如果该选项被检测到, 将会添加一个静态碰撞体的子节点, 用的是跟网格一样的几何体. 这会创建一个三角形网格碰撞体, 这个选项对碰撞检测来说很慢但是精确. 这个选项通常是关卡几何体需要的(但是也看看下面的 -colonly ).

The option -convcol will create a ConvexPolygonShape3D instead of a ConcavePolygonShape3D. Unlike triangle meshes which can be concave, a convex shape can only accurately represent a shape that doesn’t have any concave angles (a pyramid is convex, but a hollow box is concave). Due to this, convex collision shapes are generally not suited for level geometry. When representing simple enough meshes, convex collision shapes can result in better performance compared to a triangle collision shape. This option is ideal for simple or dynamic objects that require mostly-accurate collision detection.

然而,在这两个例子中,视觉几何体处理过于复杂或对于碰撞而言不够光滑。物理引擎会出现小故障从而不必要地降低了引擎的速度。

To solve this, the -colonly modifier exists. It will remove the mesh upon importing and will create a StaticBody3D collision instead. This helps the visual mesh and actual collision to be separated.

The option -convcolonly works in a similar way, but will create a ConvexPolygonShape3D instead using convex decomposition.

With Collada files, the option -colonly can also be used with Blender’s empty objects. On import, it will create a StaticBody3D with a collision node as a child. The collision node will have one of a number of predefined shapes, depending on Blender’s empty draw type:

在 Blender 中为 Empty 选择创建时的绘制类型

在 Blender 中为 Empty 选择创建时的绘制类型

可能的话,请试着使用少量图元碰撞形状,而不是三角形网格或凸型体。图元形状的性能和可靠性通常更好。

备注

For better visibility on Blender’s editor, you can set the “X-Ray” option on collision empties and set some distinct color for them by changing Edit > Preferences > Themes > 3D Viewport > Empty.

If using Blender 2.79 or older, follow these steps instead: User Preferences > Themes > 3D View > Empty.

参见

碰撞体全面概述请查看 碰撞形状(3D).

创建导航(-navmesh)

具有 -navmesh 后缀的网格节点, 将被转换为导航网格. 原始网格节点将在导入时被删除.

创建 VehicleBody(-vehicle)

A mesh node with the -vehicle suffix will be imported as a child to a VehicleBody3D node.

创建 VehicleWheel(-wheel)

A mesh node with the -wheel suffix will be imported as a child to a VehicleWheel3D node.

刚体(-rigid)

A mesh node with the -rigid suffix will be imported as a RigidBody3D.

动画循环(-loop、-cycle)

Animation clips in the source 3D file that start or end with the token loop or cycle will be imported as a Godot Animation with the loop flag set. Unlike the other suffixes described above, this does not require a hyphen.

在Blender中, 这需要使用NLA编辑器, 并用 loopcycle 前缀或后缀命名该动作.

Previous Next


© 版权所有 2014-present Juan Linietsky, Ariel Manzur and the Godot community (CC BY 3.0). Revision b1c660f7.

Built with Sphinx using a theme provided by Read the Docs.