Animating AI can seem like a daunting task if you’re unfamiliar. However, there are many tools that Unreal provides to make this easier for us. The solution that works best for you will depend on your AI’s design and your preference. Below are some tips and resources to help you along the way.
State Machines allow you to easily manage complex animations by using transitional logic. Your State Machine can trigger transitions in and out of animations by using user defined conditions. Learn more about State Machines by watching this video here. You can also visit the official documentation here.
In essence, you can use variables to determine when an animation should or should not be playing. This means that by using an Action, or any other event, you play the correct animation at any time easily. If your AI is about to start mining with a pickaxe, set a variable called “IsMining” to true and make sure you’ve setup your State Machine to reference it. Simple as that! Your AI will automatically blend between the animations necessary.
You can see a similar example in the FPS examples. If you open their Animation Blueprint, you’ll find the state machine that powers them.
Though State Machines work for most circumstances, there may be times where it doesn’t. Animation Montages allow you to control when animations are played with Blueprints or C++
- Unreal Documentation | Animation Montages
- Video Tutorial | Replicated Animation Montages