I don’t have the code on hand, but I’m using the characters pre-defined input function and calling key presses in there. I’ve put Montage_Play in Axis binds and Action binds and it didn’t work. The movement is being changed OnTick and when I call it within the if check, it plays the animation after I’m done moving. I can post code when I’m home, but it’s just the standard input function the character class gives you.
EDIT: Here’s the code. The functions that the input keys are calling is where i put the animation but it doesn’t work in either of them.
// Called every frame
void ALichDota::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );
//GEngine->AddOnScreenDebugMessage(-1, 1.0f, FColor::, FString::Printf(TEXT("Moving: %s"), moving ? TEXT("True") : TEXT("False")));
if (!Move_Vec.IsZero()) {
Move_Vec = Move_Vec.SafeNormal() * 100.0f;
FVector New_Loc = GetActorLocation();
New_Loc += GetActorForwardVector() * Move_Vec.X * DeltaTime;
New_Loc += GetActorRightVector() * Move_Vec.Y * DeltaTime;
SetActorLocation(New_Loc);
//GetMesh()->GetAnimInstance()->Montage_Play(Anim, 1.0f);
}
}
// Called to bind functionality to input
void ALichDota::SetupPlayerInputComponent(class UInputComponent* InputComponent)
{
Super::SetupPlayerInputComponent(InputComponent);
InputComponent->BindAxis("Move_X", this, &ALichDota::Move_X);
InputComponent->BindAxis("Move_Y", this, &ALichDota::Move_Y);
InputComponent->BindAction("Test", IE_Pressed, this, &ALichDota::Test);
InputComponent->BindAction("Test2", IE_Released, this, &ALichDota::Test_Two);
}