I need to be able to set the positions of certain bones at runtime, and they only need to be set once - they don’t change after that, and these bones aren’t touched by animation.
I originally got this working using FReferenceSkeletonModifier with UpdateRefPoseTransform.
However, I realized that for characters using the same reference skeleton, this affects them both. I want to be able to have characters sharing the same skeleton able to have these bone transforms in different positions.
UPoseableMeshComponent has a SetBoneTransformByName, but this is not available to USkeletalMeshComponent.
I know, one approach could be to have the offsets applied through animation, but I don’t want the added overhead of updating this many bones every frame. I want to set them once and be done, given that animation wouldn’t touch them otherwise.
Just to make sure I understand correctly, you have a skeletal mesh that has animations applied to most bones, but you’re looking to set the positions on a couple specific bones that will have no animations?
You’d need to modify it through the animation thread since the SkeletalMeshComponent doesn’t support direct bone transform override.
I was thinking, as a workaround, of using a UPoseableMeshComponent, and copying the pose over from the SkeletalMeshComponent but sadly any bone edits get overridden.
i.e. Modifying hand bone position gets reset when UPoseableMeshComponent is updated again from the SkeletalMeshComponent.
What you can do with UPoseableMeshComponent, though, is separate the bones / mesh part into a different skeleton that you’d use and edit the bones that way.
Here’s a quick thing I did with isolating the left hand into its own skeleton mesh and enlarging it.
I don’t think having them as part of a separate skeleton is an option for us.
I’ll explore setting them through a custom animation node. If I have an FTransform that works for setting UpdateRefPoseTransform, what would be the conversions I’d have to do to that transform to get an FBoneTransform that would be part of the TArray<FBoneTransform>& OutBoneTransforms in EvaluateSkeletalControl_AnyThread? I’m having trouble getting it to look right.