1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Unity】Animationをブレンドすると首が1回転するバグの記録

Last updated at Posted at 2024-03-23

概要

タイトルにもある通り、特定のアニメーションAとBをブレンドすると、ブレンド中に首が1回転するバグに遭遇。
この問題を解決したので記録に残す。

バグの内容

Videotogif.gif
こんな感じでブレンドすると首がクルっと1回転するようなバグに遭遇。
ブレンドはTimelineで行って、Animtorで行っても同じ結果になる。

結論

今回のバグの原因は、アニメーションFBXのインポート方法に問題があった。

↓これはアニメーションFBXのRigタブの一部
image.png
Avatar Definition が、Create From This Model となっている。
ここを、Copy From Other Avatar にし、アニメーション生成に使用したメッシュのアバターを設定することで解決した。

詳細

Avatar Definitionについて、Unityのドキュメントでは、

デフォルトでは、Avatar Definition プロパティは Create From This Model に設定されています。この設定では、Unity はファイル内で定義された一揃いのボーンをヒューマノイドアバターにマップしようと試みます。 

とある。つまり、AvatarをUnityが自力で作というわけだ。

image.png
↑①Unityが自力で作成したアバター、neck_01 のノードの向きが、緑が前方を向いている。

image.png
↑②Animation生成時に使用したメッシュのアバター、見てわかるとおり、首ノードの向きが逆を向いている。

このようなアバターのノードのズレがある状態のまま、アニメーションをブレンドしても当然うまく動かない。なので、ちゃんとアニメーションを生成した時に利用したメッシュのアバターを使って、アニメーションFBXをインポートしましょう。というお話でした。

以上

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?