Looking for minimal C++ code to load and play an animation on a skeletal mesh. To make it easy just fill in the ???:
// initializing the mesh and animation in an actor's constructor
FString uniqueName;
const char* meshAssetName;
const char* animationAssetName;
USkeletalMeshComponent* newMesh = CreateDefaultSubobject<USkeletalMeshComponent>(FName(*uniqueName));
RootComponent = newMesh;
ConstructorHelpers::FObjectFinder<USkeletalMesh> newAsset(ANSI_TO_TCHAR(meshAssetName));
if (newAsset.Succeeded())
{
newMesh->SetSkeletalMesh(newAsset.Object);
newMesh->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
// how to load and assign a single animation here given "animationAssetName"
???
}
// playing the animation during run time
???
Do not care about blending. Just 1 mesh, 1 animation, and Play(). Should be easy right? The documentation for this seems lacking though and I cannot find a simple example like this. ;(