Bypassing State Machine Animation to Play an Anim Montage

Hey

What I am trying to accomplish is a simple double jump feature, just like in Devil May Cry, or any third-person game.

My implementation is to launch the player in the air after detecting a second jump press while in air.
The player is launching fine, and everything is working, but I can’t play a “Double Jump” animation in air.

Take a look:

void MyGameCharacter::DoDoubleJump()
{
	eLog("DoDoubleJump(): ");
	bDidDoubleJump = true;
	bAllowDoubleJump = false;
    PlayAnimMontage(DoubleJumpAnim);

	FVector LaunchVec;
	LaunchVec = GetVelocity();
	LaunchVec.Z = 750.0f;
	CharacterMovement->Velocity += LaunchVec;
}

float MyGameCharacter::PlayAnimMontage(class UAnimMontage* AnimMontage, float InPlayRate, FName StartSectionName)
{
	USkeletalMeshComponent* UseMesh = GetPawnMesh();

	if (AnimMontage && UseMesh && UseMesh->AnimScriptInstance)
	{
		return UseMesh->AnimScriptInstance->Montage_Play(AnimMontage, InPlayRate);
	}

	return -1.f;
}

Should be pretty straight forward, but the anim montage is not running. I think that is happening because in my Character Animation Blueprint’s state machine there is a “JumpIdle” node that runs when the player is suspended in air.

Is there any way to bypass that to activate the blueprint??

Thanks

  • add a Slot called FullBody just before the end of your animation tree

  • create an anim montage that plays your jump animation

  • you’ll see a place to type in FullBody in the double jump anim montage, make sure you type that in!

  • play the anim montage any time and it will override absolutely the entire rest of your anim tree :slight_smile:

Rama

Thanks, man.
I had the FullBody slot only in the “Idle” state, which caused trouble for the other states.

I just moved the FullBody slot to be the last thing in the entire state machine, and all worked fine. Many thanks