Each blend shape of the mesh is a target. You need to create morph targets for a surface of the mesh and set parameters to these targets to control the morph target animation. The following example shows, how to create morph targets and set parameters from the code:

The code given above gets the node that refers to the FBX file and sets parameters to morph targets. Let's clarify the essential things:

The exported mesh was obtained by casting the node that refers to the FBX asset to ObjectMeshSkinned. The node is obtained from the Editor by the name.

The setNumTargets() function sets the number of targets for the surface of the mesh. The exported mesh in the example given above has 2 targets (blend shapes).

By using the setTarget() function, all parameters for each created morph target are set in the update() function. Each target has its target weight. Weights have an influence on coordinates of the mesh: coordinates are multiplied by their weights. Thus, all enabled targets are multiplied by their weights and the new mesh is created:

final_xyz = target_0_xyz * weight_0 + target_1_xyz * weight_1 + ...

Since in the code given above, sin() and cos() functions are used for animation blending of different targets, five targets are created:

Source code (C++)

mesh->setTarget(0,1,0,1.0f,0);

This target is if for the bind pose without any interpolation.

Source code (C++)

mesh->setTarget(1,1,0,-k0,0);
mesh->setTarget(2,1,0,-k1,0);

These targets are used for interpolation of two animations blending.

Source code (C++)

mesh->setTarget(3,1,1,k0,0);

This target is used for the first animation blending, which uses the sin() function for interpolation.

Source code (C++)

mesh->setTarget(4,1,2,k1,0);

This target is used for the second animation blending, which uses the cos() function for interpolation.

After assigning the material to the mesh, the result looks as follows: