LayeredBoneBlend via Code

Hey Community,

I’ve created all of my animations and have utilized them via code while working with montages. Though something I wanted to do was to have the upper half of my animation play while the lower half operates independently with another set of animations.

I’ve followed these set of video tutorials from epic but they focus on blueprints. So I thought i’d look into the nodes they were using and well… found myself stuck. I’m not entirely sure to be honest where to even begin on this.

So any assistance would be greatly appreciated for new methods to be explored. Below is the code I use when calling different animations.

	bool Idle_Bool = GetMesh()->AnimScriptInstance->Montage_IsPlaying(Idle_1);
	bool Running_Bool = GetMesh()->AnimScriptInstance->Montage_IsPlaying(Running_1);

	//Check to see if the montages are playing to make sure we don't overlap.

	if (Idle_Bool == false || Running_Bool == false) // Add additional checks for more montages.
		if (IsIdle == true && CheckStuff == false && CheckStuff2 == false) // We are currently idle.
			// Play Montage Here
			float Idle = PlayAnimMontage(Idle_1, 1.0f); // Play rate. Default is 1.0f

		else if (IsIdle == false) // We are not idle.
			if (IsRunning == true && Running_Bool == false) // We are running however.

				float Run = PlayAnimMontage(Running_1, 1.0f); // Play rate. Default is 1.0f // Check rate conditionally.

			if (IsRunningBackwards == true && Running_Bool == false)
				float Run = PlayAnimMontage(Running_1, 0.5f);
			//If IsWalking == true && Walking_Bool == false

Do the folks at Epic know? Or does anybody have any ideas?

C’mon community! Don’t let me down! As an update I included the following below but I am still wondering how to get this to work with montages! Thanks in advance!

#include "Animation/AnimNode_LayeredBoneBlend.h"

I didn’t watch video but I’m not sure exactly what is problem. If you’d like to play upper body/lower body separate, you’ll have to create anim BP and you can have two different slot node to play different montage. And from code, you’ll trigger the montage using the slot node name. What exactly is your problem here? The logic of the code is to play montage, but I don’t see any anim BP. Do you want to do everything in code including layered blending?


What Lina said,

and I wrote a wiki on extending the Anim BP in C++

Wiki Link


Gotcha! This is what I was afraid of… ah well. I CONCEDE! I will use a Anim BP. :), thanks fellas.