Hello!
The situation is as following:
I am spawning ragdoll corpses after in game characters are defeated.
I would like these ragdoll corpses to start in the same pose as the original character, and then ragdoll from there.
I have looked into pose snapshots, but there doesn’t seem to be an “AddPoseSnapshot(pose snapshot, name)” type solution. It has AddPoseSnapshot(name) which adds an empty pose snapshot, (which is then inaccessible), and GetPoseSnapshot(name) which returns a pointer to a const, which can’t be modified. I don’t even know if this is a good way to go about this, as I’m getting 0 progress.
Here’s how I would go about it:
FPoseSnapshot snapshot;
GetMesh()->SnapshotPose(snapshot);
corpse->GetSkeletalMeshComponent()->GetAnimInstance()->AddPoseSnapshot("InitialPose");
FPoseSnapshot* corpseSnapshot = corpse->GetSkeletalMeshComponent()->GetAnimInstance()->GetPoseSnapshot("InitialPose");
corpseSnapshot->LocalTransforms = snapshot.LocalTransforms;
As far as I can tell SkeletalMeshComponents don’t seem to have a “SetBoneTransfrom” method, which I could use to copy transforms over with. PoseableMeshComponents do, but those can’t be ragdolled (simulated physics on).
What can be done? Ideally without having to scrap the whole spawning corpses approach. I do realize I could not spawn new actors, just extend the original character to have a “dead” state. It’s just a lot simpler to spawn new objects than it is to alter all logic on the original character (and relating to it) to be different when it is dead.