I am using animation sequences to animate a skeletal mesh. I am playing them with USkeletalMeshComponent::PlayAnimation(). And so far everything is great, but it would be nice if the animations changed more fluidly.
I know animation montages can be used for a complex animation and allow blending, but it seems dirty putting all of my animation sequences (like idle, run, jump, fall, roll, die, etc) into a single montage and skipping around to different animations within it. I just feel like I’m not using animation montages the way they are intended… Any thoughts or recommendations would be very appreciated.
You can make an animation montage for each one of your animations (idle, run, jump, etc…), then call UAnimInstance::Montage_Play() instead of PlayAnimation(). Each montage has a blend-in time and a blend-out time so you can make transitions pretty smooth. On 4.11 you can even specify different blend functions for those.
Rantrod you are awesome! You helped me on one of the other questions I had a while ago Your solution worked very well! I was confused because I tried using Montages a while ago, but whenever I requested the AnimInstance object with GetSingleNodeInstance(), it returned null. Today I realized that I need to play an animation first before GetSingleNodeInstance will return a non-null value. But after I did that I could use Montage_Play and it worked wonderfully… Thanks for the help!!
Note that when you call UAnimInstance::Montage_Play, it returns the length of the animation already so you don’t have to look at GetSingleNodeInstance with montages. Montages also have a “GetPlayLength()” function in them. If you already called the montage, you can get the length of the currently playing montage like this:
UAnimMontage *CurrentMontage = AnimInst->GetCurrentActiveMontage();
float Len = CurrentMontage->GetPlayLength();