Save/Restore the Values to Be Manipulated (SDK for Cocos Creator)

Updated: 03/14/2023

Summary

This page describes the procedure for saving/restoring parameter values and part opacity for a Cubism model using ParameterStore.
The following explanation is based on the assumption that the project is the same as the project for which the “Import SDK” and “UpdateController Settings” are performed.

CubismParameterStore

If you click “Live2D/Cubism/OriginalWorkflow/Toggle Should Import As Original Workflow” in the Cocos Creator menu and import a model in the true state, a CubismParameterStore component will be set in the generated Prefab.

CubismParameterStore is a component that restores and saves Cubism model parameter values and part opacity before and after the AnimationClip is played.
This can be used to avoid the glitches that occur when other Cubism components manipulate values relative to each other, such as Additive and Multiply.
The value manipulations performed by Cubism components in Additive and Multiply blends assume that the value manipulations performed in the previous frame have been reset.
If the value is overwritten by AnimationClip, then the value manipulation by the Cubism component works correctly because the previous value manipulation is overwritten.
However, if the played animation does not manipulate the value, it may not behave as expected because the last manipulated value remains unchanged for the next update, resulting in duplicate values to be calculated.
CubismParameterStore saves all parameter values of the model to which it is attached at the lateUpdate() timing immediately after processing the animation, and restores the saved values at update() of the next frame.
This allows components to operate normally on parameters whose values are not overridden by animation.

The following procedure is used to save/restore parameter values and part opacity for a model generated using the conventional method.

  1. Attach CubismParameterStore

1. Attach CubismParameterStore

Attach “CubismParameterStore” to the GameObject that is the root of the model to save/restore values.

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