rotwang
(rotwang)
1
ACharacter - How to assign Animation
In the editor, I’m able to assign an animation asset to my character.
Animation Mode: Use Animation Asset
Anim To Play: ThirdPersonRun (for example)
I want to do this in C++.
How can I do this, having my character derived class AMyCharacter : public ACharacter?
(I don’t want to use any blueprints)
Here is what you need
USkeletalMesh* Mesh;
UAnimationAsset* Anim;
float AnimPlayRate = 1.0f;
GetMesh()->SetSkeletalMesh(Mesh);
GetMesh()->SetAnimationMode(EAnimationMode::AnimationSingleNode);
GetMesh()->SetPlayRate(AnimPlayRate);
GetMesh()->PlayAnimation(Anim, true);
rotwang
(rotwang)
3
Thank you very much - this worked.