To build an state machine event, open the Atoms UI and make sure to have selected the "StateMachines" tab.
If you are not familiar with state machines
Building your state machine
Click on "Add", then double-click on the state machine you just created. Rename it to "robotStateMachine".
Right click on the state machine viewport and select "Add Animation State" or press on "Add State" button.
Select the new state and change its name to "walk" .
Leave the "Id" to 0 and click on "Add Clip". From the clip list, select the clip you exported in the previous section.
Click on the "Register" button or press CTRL+S.
Your state machine is ready to be used.
Assign a state machine to an Agent type
After you created a state machine you must assign to a compatible agent type. Go to the agent type tab, select your agent type ("testRobot"), and in the state machine field set the one you just created. In this way the stateMahcine behaviour module will use the correct state machine for each agent type.
More about the state machine editor
In the state machine editor there's a variety of other things you can do. For a full list of actions please check the quick help at the bottom right of the GUI.
The Inspector
The inspector is where you set your state or transition clips.
In case you're setting up an animation state, you have to give it an id which will later be used by several Atoms Behaviour Modules such as the State machine. Each state in the same state machine must have a different id.
You can assign more than one clip to each animation state or transition.
There are three different merge modes:
- Exclusive : only the exclusive clip will be played. This mode has the highest priority. If you have an exclusive clip all the other clips will be ignored. If you have more than one exlusive clip only the first one will be used.
- Merge : all merge clips will be merged together. This has higher priority over the random mode. Having only a merge clip is like setting its mode to exclusive.
- Random : one of the random clips in the list will be played.
Finally there are also seven different motion modes: Straight, TurnLeft, TurnRight, TurnUp, TurnDown, BankLeft, BankRight.
Only clips with the same motion mode will be merged together, randomized or will exclude each other.
At each frame your agent direction changes and the angle described by the agent direction at the current frame and the direction at the previous frame will be used by the blending system.
For instance, when setting a TurnLeft clip with angle value to 1 and blend to 2, our agent will start blending the Straight clip with the TurnLeft clip when the mentioned angle will be between from 1 to 3 degrees (3 is simply the angle value plus the blend value). When the angle will be more than 3 the TurnLeft clip will be played.
The angle and blend values are in degrees.
The max turn angle field is limits the angle variation (degrees) at each frame.
Transitions
When connecting two animation states you can select the transition and assign a transition clip within the inspector.
A light blue dot will appear on your transition in the editor as soon as you assign a clip to a it.
The transition UI is similar to the state UI, the only difference is that you can specify a blend in and out frame value for the transition itself.
If you don't specify a transition clip between two states and in your simulation you pass from one of those to the other, Atoms will do a straight blend between them.
If two states do not have a transition you won't be able to pass from one to the other.
注意 |
---|
Please always give a name to your transitions or they won't be evaluated by Atoms. |
ユーザーのState Machineを構築する
「Add」をクリックして、作成したばかりの「State Machine」をダブルクリックします。 「robotStateMachine」に名前を変更します。
State Machineのビューポートを右クリックして「Add Animation State」を選択するか、「Add State」ボタンを押します。新しいStateを選び、その名前を「walk」に変更します。
「Id」を0のままにして、「Add Clip」をクリックします。クリップリストから、前のセクションでエクスポートしたクリップを選択します。「Register」ボタンをクリックするか、Ctrl + Sを押します。
以上で、ユーザーのステートマシンは使用する準備が整いました。