Download

SkeletalMesh Animation Trace

I want to develop a function that designer use level sequence do some character animation and when player come to here, the one control by player will out off control and play animation as same as the mesh in level sequence.
Designer will drag the mesh in to sequence time line and set spawned to true. Then editor it’s position, rotation and animation.
The character control by player will create when game start.
At this conditions, i design a plan. When player enter a trigger, cut off the input, and play the level sequence with hiding mesh. Then, set the character’s animation asset and the frame from the mesh in level sequence.
It’s looks simple that only get the skeletalmeshcomponent in code and set his asset from another skeletalmeshcomponent. And it will success to trace animation in any way’s skeletalmeshcomponet, if it could be.
When i coding. I encounter a difficult problem. Play a animation have 3 way by default. Use Animation Blueprint, Use Animation Asset, Use Custom Mode.
I found USkeletalMeshComponent::SetAnimation been used in a class called UAnimSingleNodeInstance. And level sequence didn’t use this class but UAnimCustomInstance and it didn’t have a set function, not get function yet.
I try to find a basic function set a asset to a skeletal mesh that i can give a break point and see stack how it work. It will show me how the asset come in, and i will found how to get the asset against.
I didn’t found a function like this but found each play mode have a proxy to real set the skeletal data to mesh. Like FAnimSequencerInstanceProxy for level sequence, FAnimSingleNodeInstanceProxy for UAnimSingleNodeInstance object.
It too complex to find the function or the way to get playing mesh’s animation asset.
Is there some one can tell me how to get a playing mesh’s animation asset no matter how it come from(may be from bp, from level sequence or from a code control).
If i can get the playing mesh’s animation asset, i could finish the animation trace.
thx