Animate SkeletalMesh with C++

Hi,

I am working on a little tank project and need some help with the animation system.
I already had a look at the C++ Vehicle tutorial where they use a Animation Blueprint to copy the rotation and translation of the physical wheels to the visual wheels.

I wonder what is the best way to achieve this without blueprints?

Basically I want to animate the wheels and the treads of the tank.

The treads have around 120 chain elements on both sides that need to be animated, setting these up with blueprints is a clicking nightmare :slight_smile:

I had a look an AnimationInstance.h & .cpp there are 2 functions

a) NativeUpdateAnimation (empty function)
b) BlueprintUpdateAnimation <– this one is virtual and not implemented

Is BlueprintUpdateAnimation generated out of the Blueprint graph?

Since all my tank skeletons have the same structure I would implement a CustomAnimationInstance and pass it to the MeshClass


	static ConstructorHelpers::FClassFinder<UObject> AnimBPClass(TEXT("/Game/VehicleAdv/Vehicle/VehicleAnimationBlueprint"));
	GetMesh()->SetAnimationMode(EAnimationMode::AnimationBlueprint);
	GetMesh()->SetAnimInstanceClass(AnimBPClass.Class);

Some Pseudocode:

// somewhere during initialization of CustomAnimationInstance
if existsBoneWithName( “track_left_element_”+i) boneIndices.add(i);

// in the update loop
foreach (boneIndex in boneIndices) updateBone(i);

My aim is to create a general animation system for tanks that needs no further configuration.

What do you think? Any better ideas to achieve this?