Setting bone transforms for an avatar controlled by an animation blueprint

Hi there,

We have an avatar that sits in a vehicle that is controlled by an animation blueprint that sets hand and feet positions using IK and other transforms all from a data struct received from C++.

If the vehicle crashes then we eject the avatar from the vehicle in a ragdoll state by enabling physics on the skeletal mesh component and adding an impulse.

I’m writing an instant replay system that currently correctly captures the all the relevant vehicle transform data and the avatar position derived from that except for when it is ejected from the vehicle.

I looked through the code of the sequencer and found that the it gets it’s data from USkeletalMeshComponent::GetSpaceBases so I am now capturing that while the avatar is in the ejected ragdoll state. For replaying back the captured on the avatar I found that there is USkeletalMeshComponent::GetEditableSpaceBases or potentially more appropriately USkeletalMeshComponent::UpdateKinematicBonesToAnim, which takes the SpaceBases (TArray) as a parameter.

My question is how can I stop the animation blueprint from controlling the avatar and only have the UpdateKinematicBonesToAnim affect the avatar, or else what is the correct way of setting the skeletal mesh to my captured space bases? I looked into what happens when physics is enabled for the skeletal mesh but it seems that the avatar all the UpdateAnimation code is still run but that the physics logic overrides it (I’m assuming for the purposes of allowing blending in/out of physics).

Many thanks

From investigating further into the code it appears as though my call to UpdateKinematicBonesToAnim or the setting of the SpaceBases is occurring before USkeletalMeshComponent::RefreshBoneTransforms which will be overwriting the values I set. There doesn’t seem to be a public way to disable stop this from happening or any kind of hook after it for me to set the values at that time. Can a staff member shed any light?

I’m going to look into how IK manages blend/overwrite bone transforms next to see if there’s a way to set the transforms in that area.

Thanks