Unity では Animation Layers を使用すると、複雑なステートマシンを体の各部分ごとに管理することができます。例えば、下半身のレイヤーで歩きやジャンプを管理して、上半身のレイヤーではオブジェクトを投げたり、撃ったりする、といった場合です。
アニメーションレイヤーは Animator Controller の左上角にある Layers Widget から管理することができます。
ウィンドウ右側の歯車アイコンをクリックすると、そのレイヤーの設定が確認できます。
各レイヤーでは、マスクとブレンドタイプを指定します。マスクは、アニメーションを適用するボディパーツを指定します。ブレンドタイプは、アニメーションをどのように適用するかを指定します。
ウィジェットの上にある + を押して、新しいレイヤーを追加します。
Mask プロパティでは このレイヤーで使用するマスクを指定 します。例えば、キャラクターが歩いたり、走ったり、その場で立ち止まったりしているときに、上半身にだけ投球アニメーションを再生したい場合は、上半身の投球アニメーションを再生するレイヤーにマスクを使用します。マスクは次のように設定します。
レイヤーのサイドバーにある M マークは、そのレイヤーにマスクがあることを示しています。
場合によっては、同じステートマシーンを異なるレイヤーで再利用する方が便利な時があります。例えば “負傷した” 動作を表現したい場合に、“健康な” アニメーションではなく、歩行/走行/ジャンプの “負傷した” アニメーションを持っているとします。レイヤーの 1 つで Sync チェックボックスをクリックしてから、そのレイヤーと同期したいレイヤーを選択します。すると、ステートマシーンの構造は同じになりますが、各ステートで使われるアニメーションクリップは区別されます。
つまり、同期したレイヤーは固有のステートマシーンを持たず、代わりに同期元レイヤーのインスタンスであることを意味します。同期したレイヤービューでステートマシンのレイアウトや構造への変更 (例えば、ステートまたは遷移の追加/削除) は、同期したレイヤーのソースに対して行われます。 同期したレイヤーの変更で唯一固有なのは、各ステート内で使用される選択されたアニメーションです。
Timing チェックボックスを使うと、同期されたレイヤーにあるアニメーションの長さを、重みを用いて調整することが可能になります。Timing が選択されていない場合、同期先のレイヤーにあるアニメーションが調整されます。調整は、元のレイヤーにあるアニメーションの長さにあわせて伸縮することで行われます。オプションが選択されている場合、アニメーションの長さは、重みを基準にして両者のバランスをとる形で調整されます。どちらの場合でも (選択しても、選択しなくても) アニメーターはアニメーションの長さを調整します。選択しない場合、元のレイヤーが唯一の基準になります。選択した場合、両者の調整になります。
レイヤーのサイドバーにある S マークは、そのレイヤーが同期されていることを示しています。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.