根本となる概念は、キャラクターは、どんなときでもいくつかの特定のアクションに関与しているということです。利用可能なアクションはゲームの種類に依存しますが、アイドリング、ウォーキング、ランニング、ジャンプ等のような典型的なアクションが含まれます。これらのアクションは ステート (キャラクターが歩行、アイドリングなどの “ある具体的な状況や状態” にあるという意味です) と呼ばれます。一般的には、キャラクターはある状態から他の状態にすぐに切り替われるのではなく、遷ることができる次の状態には制約があります。例えば、ランニングジャンプはキャラクターがすでに走っているときのみ可能で、立って停止しているときにはできません。ですから、停止のステートからジャンプのステートに直接切り替えるべきではありません。キャラクターが現在のステートから入ることができる次のステートのオプションを ステートの遷移 と呼びます。一群のステート、一群の遷移、現在のステートを記憶する変数がまとまって ステートマシン を構成します。
ステートとステートの遷移は図で表すことができ、ノードがステートを、矢印が遷移を表します。現在のステートは、ノードの 1 つ (マーカー/ハイライトがついているもの) で、遷移は矢印の 1 つに沿って別のノードにジャンプすることだけが可能です。
アニメーションにおいてステートマシンの重要性は、ほとんどコードを書くことなく、非常に簡単に設計と更新ができることです。各ステートには、マシンがそのステートにあるときはいつでも再生されるモーション (動き) が関連付けられています。 これにより、アニメーターやデザイナーは、コードがどのように機能するかを気にすることなく、キャラクターアクションとアニメーションの可能なシーケンスを定義できます。
Unity のアニメーションステートマシンを利用すると、特定のキャラクターに関連するすべてのアニメーションクリップの全体を把握し、ゲーム内の様々なイベント (例えば、ユーザー入力) でさまざまなアニメーションを発生させることが可能になります。
アニメーションのステートマシンは、アニメーターコントローラー ウィンドウ から設定できます。以下のようなものです。
ステートマシンは、State (ステート)、Transition (遷移)、Event (イベント) で構成され、小さいサブステートマシンはより大きなマシンの構成物となります。詳細は、アニメーションステート と ステートの遷移 を参照してください。
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.