|
|
|
# Animation
|
|
|
|
Most mobs have animations that breathe life into them. With the help of Model Engine, you can use custom idle, walk, attack, and any other animations you wish.
|
|
|
|
|
|
|
|
## State and Priority
|
|
|
|
### State
|
|
|
|
Let's start with the basics.
|
|
|
|
With Model Engine, models move according to the states they have. Each model can have multiple states at once. For example, a model can be walking and attacking at the same time. You are not required to create a unique animation for such situations. Model Engine will automatically combine the animations you assigned to both states, and create a new animation.
|
|
|
|
#### Default states
|
|
|
|
Default states are states automatically handled and played by Model Engine.
|
|
|
|
Currently, there are 4 default states: `idle`, `walk`, `jump`, `death`, and `spawn`.
|
|
|
|
### Priority
|
|
|
|
Each state has its priority. The lower the priority, the earlier it is applied to the model, which means it has less effect on the model than those states with higher priority. This is particularly useful when [overriding](https://github.com/Ticxo/Model-Engine-Wiki/wiki/_new#override) states, such as `attack` animation overriding `idle` animation due to its importance.
|
|
|
|
|
|
|
|
Under BlockBench's animation tab, you can add states and order them by using the `Animations` window:
|
|
|
|
> ![](https://raw.githubusercontent.com/Ticxo/Model-Engine-Wiki/master/wiki/animation/state_and_priority.png)
|
|
|
|
|
|
|
|
Where the state is the animation name, and the state priority is ordered from top to bottom, lowest to highest.
|
|
|
|
|
|
|
|
## Loop and Override
|
|
|
|
Loop and Override are two very basic yet important options you can select for your animation. It controls how a state should be interpreted and executed.
|
|
|
|
### Loop
|
|
|
|
Loop flags an animation that it will run indefinitely until the state is removed. Normally, an animation without `Loop` option will only run once, and the state will be automatically removed. If the animation is set to `Loop`, it will return to the first frame and run the animation again.
|
|
|
|
### Override
|
|
|
|
Override flag tells Model Engine that this animation should cancel all animations that have lower priority than it. This option is mainly used when the model has multiple states, but you don't want other animations interrupting it. For instance, a special attack animation shouldn't combine with `idle` or `walk`.
|
|
|
|
|
|
|
|
You can toggle these options in BlockBench by right-clicking on one of the animations and checking the checkboxes.
|
|
|
|
> ![](https://raw.githubusercontent.com/Ticxo/Model-Engine-Wiki/master/wiki/animation/loop_and_override.png)
|
|
|
|
|
|
|
|
You can check both options at the same time. Model Engine will have no problem reading that.
|
|
|
|
|
|
|
|
## Animating
|
|
|
|
Animating in BlockBench is pretty straightforward. However, there are a few key points:
|
|
|
|
* Usable Timelines
|
|
|
|
* Only `Position` and `Rotation` timeline can be used when animating. Model Engine will ignore any changes in `Scale` timeline, as it is impossible to scale in Minecraft without using a lot more resources.
|
|
|
|
* Usable Bones
|
|
|
|
* You can animate all bones except `hitbox` and `effect`. `hitbox` bone will be ignored by Model Engine as it is removed as soon as it is loaded, while `effect` bone is still under development.
|
|
|
|
* FPS
|
|
|
|
* Since Minecraft updates 20 times per second (0.05s per tick), all animations will run at 20 fps, and all keyframes must be spaced at least 0.05 seconds away.
|
|
|
|
* You can configure the snap option in BlockBench by changing the Animation Snap option to 20, located under File/Settings/Snapping. The timeline slider would then move at 0.05 intervals.
|
|
|
|
* Keyframe Types
|
|
|
|
* Both linear and smooth keyframe can be used.
|
|
|
|
|
|
|
|
Let's add some animations to the model we made before.
|
|
|
|
#### idle [Loop]
|
|
|
|
> ![](https://raw.githubusercontent.com/Ticxo/Model-Engine-Wiki/master/wiki/animation/idle.gif)
|
|
|
|
#### walk [Loop]
|
|
|
|
> ![](https://raw.githubusercontent.com/Ticxo/Model-Engine-Wiki/master/wiki/animation/walk.gif)
|
|
|
|
#### attack [Override]
|
|
|
|
> ![](https://raw.githubusercontent.com/Ticxo/Model-Engine-Wiki/master/wiki/animation/attack.gif)
|
|
|
|
|
|
|
|
These are 3 very basic animations done simply by moving and rotating a few parts. However, more complicated animations are also done by such methods, only using more frames to create more fluid movements. Since this model is a robot, robotic movements are fine.
|
|
|
|
|
|
|
|
## Importing Animations
|
|
|
|
Animations are automatically imported through the `.bbmodel` file you provided. No extra steps needed.
|
|
|
|
|
|
|
|
## Results
|
|
|
|
> ![](https://raw.githubusercontent.com/Ticxo/Model-Engine-Wiki/master/wiki/animation/kindletronjr_in_game.gif)
|
|
|
|
|
|
|
|
> Note: the animations shown here is controlled through MythicMobs.
|
|
|
|
|
|
|
|
With enough patience, you too can achieve something like this:
|
|
|
|
|
|
|
|
[Video Demo](https://youtu.be/q_PGwPKPn-U) |
|
|
|
\ No newline at end of file |