Notes on Pose Switching
Updated: 09/04/2019
This section describes what to keep in mind when switching poses using Mecanim.
Summary
The Cubism 3 or later version of the Cubism SDK for Unity allows switching outfits and parts using Mecanim.
However, care should be taken when setting switching for models that have multiple switches, such as clothing switching and arm part switching.
As an example, if you switch to “Arm Part B” during “motion playback using Arm Part A,” the animation will not be applied to Arm Part B.
Also, when exporting a model, it must be exported with all necessary parts displayed.
Similarly, when exporting motion, it is necessary to export all required parts.
Details
Notes on pose switching using Mecanim
The Cubism 3 or later version of the Cubism SDK for Unity allows switching poses using Mecanim, but the animation may not play correctly depending on the pose switching parts the model has.
An example is the switching of parts with parameters during animation playback.
To illustrate this issue, we will use Haru as an example.
Haru has two types of arm parts, A and B, and two types of clothing parts, one-piece and uniform.
In this state, four combinations are possible.
If an animation using Arm Part A with Haru’s arms extended is playing and you switch to Arm Part B with the arms crossed using a script or BlendTree in Unity, Arm Part B will not move as shown in the following GIF because the parameters for Arm Part B are not set in the animation file generated from .model3.json.
When switching between two arm parts and two types of clothing, as in the case of Haru, the table below shows whether the animation works correctly or not.
Arm Part A + Clothing Part A | Arm Part B + Clothing Part B | |
Arm Part A + Clothing Part B | ○ | × |
Arm Part B + Clothing Part A | × | ○ |
There are two solutions.
1. Attach motion to Arm Part B.
2. Do not switch parts that are related to parameter settings, such as arm parts, during animation playback.
Notes on models and motion export
Another point to note is the export of models and motion.
Regarding models, as with the Cubism 2.1 SDK, hidden parts are not exported in the default model export settings.
This problem can be solved by exporting with all necessary parts displayed.
Motion also needs to be exported for the required parts.
Follow the steps below when exporting.
1. Set keyframes in the Cubism Editor for all parameters and parts to be used.
2. In the export settings, set “Export target” -> “Parameter” and “Part(s)” to “Parameters with keys” and “Parts with keys,” respectively, and export.
Regarding step 1, in addition to motion keyframes for each motion, it is also necessary to enter part keyframes.
“All parameters and parts to be used” means the motion parts used in the movement and display of the model.
Parameters that are not moved by a particular motion must also be keyframed. Parts need to be keyframed as well, especially parts that have not changed.
If motion transition is performed without exporting all the parameters and parts to be used, the expected display will not result.
See the image below as an example.
If no part keyframes are hit in the motion, the motion will be equivalent to the actual motion in the lower row of images, not the assumed motion in the upper row.
In addition, the changes to be made in step 2 are shown in the red box in the image below.
Types of problems caused by forgetting to hit keyframes
The problems that occur will change depending on the keyframe of the parameter and the keyframe of the part that you forgot to hit.
If you do not hit keyframes for parameters you do not want to move
• Parameters of the model affect the motion that was running just prior.
Example: Another motion is played back with the eyebrows raised
If you do not hit keyframes for parts you do not want to change
• Parts that you do not want to display may be displayed.
Example: Clothing is doubly displayed. Four arms are displayed.