メインコンテンツまでスキップ

アニメーション

v0.44 から部分的に対応しています。

VRM のアニメーション

VRM は、Animation を使わないという仕様です。

Export は Runtime では動作しません

Runtime では AnimationClip の情報を取得できないため、Export は動作しません。

対応状況

channel.pathtypeimportexport
translationvec3
rotationquaternion
scalevec3
weights(morphTarget)float[]
interpolationimportexport
LINEAR
STEP
CUBICSPLINELINEAR

Export

Animatorをエクスポートする場合

  1. ルートGameObjectにAnimatorコンポーネントを追加
  2. AnimatorControllerを作成し、それをAnimatorのController項目に設定
  3. UnityEditorのツールバーからWindow>AnimationでAnimationウインドウを開く
  4. ルートGameObjectが選択状態であることを確認してAnimationウインドウ中央に表示されているCreateボタンを押してAnimationClipを作る
  5. このクリップに対してアニメーションキーを追加
  6. UniGLTF>Exportからglbを出力する

Animationをエクスポートする場合

  1. ルートGameObjectにAnimationコンポーネントを追加

  2. UnityEditorのツールバーからWindow>AnimationでAnimationウインドウを開く

  3. ルートGameObjectが選択状態であることを確認してAnimationウインドウ中央に表示されているCreateボタンを押してAnimationClipを作る

  4. Inspectorの設定をDebugモードにしてAnimationClipのLegacyフラグをONにする Interpolation

  5. AnimationコンポーネントのAnimation項目に作成したAnimationClipを設定

  6. クリップに対してアニメーションキーを追加

  7. UniGLTF>Exportからglbを出力する

注意事項

  1. RotationKeyのInterpolation設定をQuaternionかまたはEulerAngles(Quaternion)にすること Interpolation
  2. Animatorの場合は設定されている全てのClipを検索して書き出しをしているが、ステートの状態などは出力されない
  3. Animator経由だと複数のアニメーションが書き込まれるが、UniGLTFのImporterが読み込むのは最初の1つだけ(UniGLTF-1.25時点)

export properties

Assets/UniGLTF/Editor/Animation/AnimationExporter.cs

property
m_LocalPositionvec3
localEulerAnglesRaw未実装
m_LocalRotationquaternion
m_LocalScalevec3
blendShapefloat[] すべての blendShape の状態をまとめて記録する

interpolation

Assets/UniGLTF/Editor/Animation/AnimationExporter.cs

unityexport
AnimationUtility.TangentMode.LinearglTFAnimationTarget.Interpolations.LINEAR
AnimationUtility.TangentMode.ConstantglTFAnimationTarget.Interpolations.STEP
その他glTFAnimationTarget.Interpolations.LINEAR

glTF: CUBICSPLINE == AnimationUtility.TangentMode.Free