Functional Layers in glTF / glb models

Enhance your GLB models with special properties by adding keywords to the layers. This allows you to utilize advanced 3D functions such as defining colliders, controlling animations, and hiding specific parts of the model.

Functional layers in glTF / glb models allow for the assignment of specific functions to different parts of the model. This can be done by adding keywords, also known as tags, to the names of the layers.

You can find the basics of working with layers in 3D models in this article.

Keywords are indicated by a preceding hashtag (#) in front of the keyword. So, the format is "#keyword".

The keyword can be placed at any position in the layer name, but it is recommended to place it at the beginning. The capitalization of the keyword does not matter.

Hiding Layers with "#hidden"

If the keyword #hidden is used in a layer name, that layer will not be rendered initially and will remain invisible. It can be re-displayed using the Show Asset action.

Tip:

In the asset preview of a GLB model, you can view the layer structure and copy it as text to use with the Show Asset or Hide Asset actions.

Defining Colliders

3spin Learning can automatically convert GLB layers into different types of colliders, which are used for collision detection.

The collider always refers to the mesh of the corresponding layer. Child layers do not affect the collider.

Each layer can only have one collider. If multiple collider keywords are defined in a layer's name, only one collider will be created, following this order: Box Collider, Sphere Collider, and finally Mesh Collider.

When a layer has a collider, the mesh of the collider is removed and becomes invisible.

Box Collider

This collider forms a box around the layer's mesh and is highly performant.

The keywords for creating a box collider are:

  • #bcollider
  • #colliderb

Sphere Collider

This collider forms a sphere around the layer's mesh and is also highly performant.

The keywords for a sphere collider are:

  • #scollider
  • #colliders

Mesh Collider

This collider corresponds to the layer's mesh. However, concave shapes cannot be represented and are automatically converted into convex shapes. In other words, the mesh collider covers a shape with a tight-fitting hull.

For complex meshes, this type of collider can become unperformant quickly. It is recommended to use box and sphere colliders whenever possible.

The keyword for creating a mesh collider is:

  • #collider

For box and sphere colliders, which automatically fit around the meshes, the rotation in the 3D program affects the collider's placement.

On the right is a normal rotation, on the left is with "Freeze Transform" (all rotation values are set to "0").

Controlling Animations

Animations within GLB files can also be modified with keywords that define specific properties.

The keyword can be placed at any position in the animation name. The capitalization of the keyword does not matter.

Automatically Playing Animations

If the keyword #autoplay appears in an animation name, that animation will be played automatically. There is no need for a separate action to play this animation.

Repeating Animations

By using the keyword #loop in an animation name, that animation will be repeated endlessly when played. This applies whether the animation is started with autoplay or with the Play 3D Animation action.

Tip:

In the asset preview of a GLB model, you can view the animation names and copy them as text to use with the Play 3D Animation action.