Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

Node type customization using name suffixes

Souvent, lors de l'édition d'une scène, il y a des tâches communes qui doivent être effectuées après l'exportation :

  • Ajout de détection de collision aux objets.

  • Réglage des objets comme maillages de navigation.

  • 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.

Avertissement

All the suffixes described below are case-sensitive.

Supprimer les nœuds (-noimp)

Les objets qui ont le suffixe -noimp seront supprimés à l'importation, quel que soit leur type. Ils n'apparaîtront pas dans la scène importée.

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

Créer des collisions (-col, -convcol, -colonly, -convcolonly)

L'option -col ne fonctionnera que pour les objets Mesh. Si elle est détectée, un nœud de collision statique enfant sera ajouté, en utilisant la même géométrie que le maillage. Cela créera une forme de collision de maillage triangulaire, ce qui est une option lente mais précise pour la détection de collisions. Cette option est généralement celle que vous souhaitez pour la géométrie de niveau (mais voir aussi -colonly ci-dessous).

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.

Cependant, dans les deux cas, la géométrie visuelle peut être trop complexe ou pas assez lisse pour les collisions. Cela peut créer des glitches physiques et ralentir le moteur inutilement.

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:

Choosing a draw type for an Empty on creation in Blender

Choosing a draw type for an Empty on creation in Blender

Dans la mesure du possible, essayez d'utiliser quelques formes primitives de collision au lieu de maillages triangulaires ou de formes convexes. Les formes primitives ont souvent les meilleures performances et une meilleure fiabilité.

Note

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.

Voir aussi

Voir Formes de collision (3D) pour un aperçu complet des formes de collisions.

Créer une navigation (-navmesh)

Un nœud de maillage avec le suffixe -navmesh sera converti en un maillage de navigation. Le objet Mesh original sera supprimé à l'importation.

Créer un VehicleBody (-vehicle)

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

Créer une VehicleWheel (-wheel)

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

Corps Rigide (-rigid)

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

Boucle d'animation (-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.

Dans Blender, cela nécessite d'utiliser l'éditeur NLA et de nommer l'Action avec le préfixe ou le suffixe loop ou cycle.