Use the Expression Function (SDK for Cocos Creator)

Updated: 03/14/2023

This page describes the procedure for playing back facial expressions on Cubism models using Expression.
The following explanation is based on the assumption that the project is the same as the project for which the “Import SDK,” “How to Set Up UpdateController,” and “Save/Restore the Values to Be Manipulated” are performed.

Summary

To play back facial expressions in the Live2D Cubism SDK for Cocos Creator using .exp3.json, use the “Expression” component.

If the model was imported with “Live2D/Cubism/OriginalWorkflow/Should Import As Original Workflow” checked in the Cocos Creator Editor menu, the Expression will be set in the generated Prefab.

To set Expression on a Prefab that is not generated using the OW method, perform the following three steps.

  1. Attach CubismExpressionController
  2. Set “[modelName].expressionList”
  3. Set the facial expression to be played

1. Attach CubismExpressionController

Attach “CubismExpressionController” to the Node that will be the root of the model.

CubismExpressionController has two setting items.

  • Expression List: Set “modelName.expressionList” (Note: Details are explained in Step 2)
  • Current Expression Index: Set the index of the expression to be played back (Note: Details are explained in Step 3)

2. Set “modelName.expressionList”

Select the model and drag and drop “[modelName].expressionList” from the Inspector View into the “Expression List” of the CubismExpressionController.

Note: “[modelName].expressionList” is a list of “.exp3” assets.
Note: The “.exp” asset is the asset where Expression data is stored. The “.exp3.json” is automatically generated when imported.

3. Set the Facial Expression to Be Played

Set the index of the expression to be played in “Current Expression Index” in CubismExpressionController. In this example, set it to 0.

This completes the setup for playback of facial expressions using the exp3 asset generated from exp3.json.

When the Scene is executed in this state, the expression number 0 in “[modelName].expressionList” will be played.
By resetting the “Current Expression Index,” you can switch the expression to be played back.

Note: If an index other than “[modelName].expressionList” is set, the default expression will be played.

Was this article helpful?
YesNo
Please let us know what you think about this article.