Expression (UE)
Updated: 09/05/2024
This page contains statements regarding the alpha version.
Summary
Expression is a function that handles Cubism’s Expression Motion, which can be set by adding or multiplying the value of a parameter for an expression to the value of the current parameter.
The settings file for the expression function is exported in .exp3.json format.
Click here for more information on the mechanism of facial expressions.
How to handle the component
Expression in the Cubism SDK for Unreal Engine can be used by adding a CubismExpressionComponent to child components of a CubismModel actor.
If the .exp3.json path is set in .model3.json, CubismExpressionComponent is automatically added to the CubismModel actor as a child component during importing, so no configuration on the user side is required.
How to play back expression motion
When the model is imported, .exp3.json is converted to .uasset for Unreal Editor and added to the Jsons array of CubismExpressionComponent.
In Unreal Editor, expression motion can be applied by specifying for Index the index of the expression motion to be played back, which is registered in Jsons. Motion is not applied if Index is outside the range of the array index.
The order in which motions are registered can be changed arbitrarily in the editor, and users can also add or delete motions arbitrarily, although this is usually unnecessary.
The following functions provided in CubismExpressionComponent are used to control the playing back and stopping of motion.
UFUNCTION(BlueprintCallable, Category = "Live2D Cubism") void PlayExpression(const int32 InIndex); UFUNCTION(BlueprintCallable, Category = "Live2D Cubism") void StopAllExpressions(const bool bForce = false);
- PlayExpression
- InIndex
Specify the index in Jsons of the motion to be played back.
- InIndex
- StopAllExpressions
- bForce
If true is specified, motion is forced to stop without the fade being applied.
If false is specified, motion stops with the fade being applied.
- bForce
Update order
CubismExpressionComponent is responsible for the expression motion update process, but the updates are applied after CubismParameterStoreComponent is updated.
This is to ensure that updates made by CubismExpressionComponent do not affect the next frame.
Calling CubismParameterStoreComponent::LoadParameters() after updating CubismExpressionComponent may result in unintended behavior.