アニメーション
v0.44 から部分的に対応しています。
VRM のアニメーション
VRM は、Animation を使わないという仕様です。
Export は Runtime では動作しません
Runtime では AnimationClip の情報を取得できないため、Export は動作しません。
対応状況
| channel.path | type | import | export |
|---|---|---|---|
| translation | vec3 | ○ | ○ |
| rotation | quaternion | ○ | ○ |
| scale | vec3 | ○ | ○ |
| weights(morphTarget) | float[] | ○ | ○ |
| interpolation | import | export |
|---|---|---|
| LINEAR | ○ | ○ |
| STEP | ○ | ○ |
| CUBICSPLINE | ○ | LINEAR |
Export
Animatorをエクスポートする場合
- ルートGameObjectにAnimatorコンポーネントを追加
- AnimatorControllerを作成し、それをAnimatorのController項目に設定
- UnityEditorのツールバーからWindow>AnimationでAnimationウインドウを開く
- ルートGameObjectが選択状態であることを確認してAnimationウインドウ中央に表示されているCreateボタンを押してAnimationClipを作る
- このクリップに対してアニメーションキーを追加
- UniGLTF>Exportからglbを出力する
Animationをエクスポートする場合
-
ルートGameObjectにAnimationコンポーネントを追加
-
UnityEditorのツールバーからWindow>AnimationでAnimationウインドウを開く
-
ルートGameObjectが選択状態であることを確認してAnimationウインドウ中央に表示されているCreateボタンを押してAnimationClipを作る
-
Inspectorの設定をDebugモードにしてAnimationClipのLegacyフラグをONにする

Interpolation -
AnimationコンポーネントのAnimation項目に作成したAnimationClipを設定
-
クリップに対してアニメーションキーを追加
-
UniGLTF>Exportからglbを出力する
注意事項
- RotationKeyのInterpolation設定をQuaternionかまたはEulerAngles(Quaternion)にすること

Interpolation - Animatorの場合は設定されている全てのClipを検索して書き出しをしているが、ステートの状態などは出力されない
- Animator経由だと複数のアニメーションが書き込まれるが、UniGLTFのImporterが読み込むのは最初の1つだけ(UniGLTF-1.25時点)
export properties
Assets/UniGLTF/Editor/Animation/AnimationExporter.cs
| property | |
|---|---|
| m_LocalPosition | vec3 |
| localEulerAnglesRaw | 未実装 |
| m_LocalRotation | quaternion |
| m_LocalScale | vec3 |
| blendShape | float[] すべての blendShape の状態をまとめて記録する |
interpolation
Assets/UniGLTF/Editor/Animation/AnimationExporter.cs
| unity | export |
|---|---|
| AnimationUtility.TangentMode.Linear | glTFAnimationTarget.Interpolations.LINEAR |
| AnimationUtility.TangentMode.Constant | glTFAnimationTarget.Interpolations.STEP |
| その他 | glTFAnimationTarget.Interpolations.LINEAR |