Animation Playback

[Last updated: 01/30/2020]

This tutorial is about how to play an embedded animation file exported from the Cubism Editor on a model in a Unity project.

This explanation is based on the assumption that the model will be added to the project in which [Importing SDK - Placing Models] was performed.

 

Summary

To play Cubism animations on a Unity project, a motion file in .motion3.json format is required.
For information on exporting motion files, please click here.

The SDK also provides an Importer for motion3.json as well as models, and motion3.json is automatically converted to Unity's animation format, AnimationClip, upon import.

The converted AnimationClip makes it possible to handle animations on Unity using only Unity's built-in functions, without using Live2D's functions.

 

The procedure for playing back motion in a Unity project is as follows.

  • Import motion files
  • Play AnimationClip

 

Import motion files

Drag and drop a motion file exported from the Cubism Editor into the Project view, along with the folder containing it.

Then, an AnimationClip is generated from motion3.json, as shown in the following image.
Loop can also be set on the generated AnimationClip.

 

 

 

TIPS

This AnimationClip has a curve with values to set for each parameter of the model, and
the properties for the parameters set by this curve are located in the following hierarchy of the model's Prefab. (Value is hidden on Inspector)

[model root]/Parameters/[parameter ID]/Cubism Parameter/Value

The maximum and minimum values to be set for Value are different for each parameter ID, but values outside that range are treated as maximum or minimum values.

The opacity of the part is also located in the following hierarchy of Prefab. (Opacity is hidden on Inspector)

[Root of Model]/Parameters/[Part ID]/Cubism Part/Opacity

The value set for Oacity ranges from 0 to 1. Values outside this range are treated as 0 or 1.

Specifying these properties will allow you to
manipulate the parameters of the model and the opacity of the parts from an AnimationClip or program created in Unity.

 

 

 

Play AnimationClip

There are several ways to play an AnimationClip in Unity, but here we will use Animator as an example.

 

Drag and drop the AnimationClip generated by “Import Motion File” onto the root GameObject of the model.

When a Scene is executed in this state, the animation is played.

As mentioned above, Cubism's animation format is converted to AnimationClip when imported into a project,
allowing for management of transitions and blending of multiple motions in Animator.

For more information, please click here.

Tips

In Live2D Cubism SDK for Unity, the fade time set in motion3.json is disabled by default.
For instructions on enabling fades in motion3.json, see “
Enabling Motion Fades in Mecanim”.

 

 

© 2010 - 2022 Live2D Inc.