Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

You may or may not be familiar with state machines. You will find plenty of explanations on the internet about what they are and how they work, especially in the gaming field.

To put it in simple words, state machines are a way for defining a number of animation states (walk, idle, run, etc) and how you can transition from one state to another. To make things even simpler, you might think of a state machine as a graph having nodes (the states) and connected to each other (connections are the transitions).

The Atoms UI has a state machine editor where you can define state machines to be used in Atoms. For a full list of actions please check the quick help at the bottom right of the GUI.


For creating animation states right click on the viewport and select "add animation state" or click the "Add state" button.
You create connections by right clicking on a node and dragging.

The Inspector

The inspector is where you set up your state and 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 (a unique id is given set as default by the editor). 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. At the end of each clip another random clip is used. From Atoms 2.1.0, you can control the random probability of each clip with agent metadatas. Specify the metadata name inside the tag field, then add a metadata with that name on your simulation agents. The metadata value represents the weight used by the random function.

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.

Whenever a one shot clip (non-loopabe clip) is used inside a state, the transition will be triggered as soon as the animation of that clip ends.

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.

  • No labels