|
Animating a model |
|
Most mobs have animations that breathe life into them. With the help of Model Engine, you can use custom idle, walk,
|
|
\ No newline at end of file |
|
attack, and any other animations you wish.
|
|
|
|
|
|
|
|
## Fundamentals
|
|
|
|
|
|
|
|
### 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.
|
|
|
|
|
|
|
|
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 Mode
|
|
|
|
|
|
|
|
Loop Mode determines whether an animation should run only once, indefinitely, or hold on last frame until it is removed.
|
|
|
|
|
|
|
|
When a state is set to only play once, the state would be automatically removed from the model after playing.
|
|
|
|
|
|
|
|
If it is set to loop, the state will loop back to the first frame, and only stop playing when the state is removed
|
|
|
|
manually.
|
|
|
|
|
|
|
|
Finally, as the name would suggest, hold on last frame will stay on the last animation frame instead of looping back.
|
|
|
|
|
|
|
|
### 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.
|
|
|
|
|
|
|
|
### Default states
|
|
|
|
|
|
|
|
Default states are states automatically handled and played by Model Engine.
|
|
|
|
Here is a list of default states and their behaviors.:
|
|
|
|
|
|
|
|
| State | Condition | Loop Mode | Override |
|
|
|
|
|------------|---------------------------------------------------------------------------------------------|-------------------|----------|
|
|
|
|
| idle | Not moving | Loop | No |
|
|
|
|
| walk | Moving | Loop | No |
|
|
|
|
| jump_start | Start jumping | Once | Yes |
|
|
|
|
| jump | After jumping and while in mid air | Loop | Yes |
|
|
|
|
| jump_end | After jumping and when lands on the ground. | Once | Yes |
|
|
|
|
| spawn | On model first spawn. | Once | Yes |
|
|
|
|
| death | On model death.<br> This state will forcibly remove all existing animations from the model. | Hold on last tick | Yes |
|
|
|
|
|
|
|
|
## Animating
|
|
|
|
|
|
|
|
Animating in BlockBench is pretty straightforward. However, there are a few key points:
|
|
|
|
|
|
|
|
* Usable Bones
|
|
|
|
* You can animate all bones except `hitbox`. `hitbox` bone will be ignored by Model Engine as it is
|
|
|
|
removed as soon as it is loaded.
|
|
|
|
* FPS
|
|
|
|
* Since Minecraft updates 20 times per second (0.05s per tick), all animations will run at 20 fps internally.
|
|
|
|
However, Model Engine can interpret higher FPS animations, and by default the animation would be played back at
|
|
|
|
max FPS in game.
|
|
|
|
* 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. Bezier keyframe is under development
|
|
|
|
|
|
|
|
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://img.youtube.com/q_PGwPKPn-U/0.jpg) |
|
|
|
\ No newline at end of file |