I have a first person player, I want to play arms animation in c++ code.
My code:
AMyPlayerCharacter::AMyPlayerCharacter()
{
...
static ConstructorHelpers::FObjectFinder<USkeletalMesh>armsCH(TEXT("SkeletalMesh'/Game/Animation/ArmsAndFlashLight/arms.arms_armmesh'"));
static ConstructorHelpers::FObjectFinder<UAnimSequence>idleAnimation(TEXT("AnimSequence'/Game/Animation/ArmsAndFlashLight/arms_armmesh_Anim_Armature_Idle_001.arms_armmesh_Anim_Armature_Idle_001'"));
armsSkeletalMesh = armsCH.Object;
if (armsSkeletalMesh != nullptr)
{
arms->SetSkeletalMesh(armsSkeletalMesh);
arms->SetRelativeLocation(FVector(30, -3, -30));
arms->SetAnimationMode(EAnimationMode::AnimationSingleNode);
arms->PlayAnimation(idleAnimation.Object, true);
}
,,,
}
However, this code doesn’t work, the animation doesn’t play.