- Home /
Retargeting raw bone transformations with avatar definition onto a different Avatar + hierarchy
The goal is to retarget the animation from a dynamically animated character onto another whose correspondence is encoded in Mecanim.
The problem boils down to: How can I bake a character's instantaneous bone transformations into muscle values? I change the bones' rotations in code in real time, there is no underlying animation clip. If you don't understand this significance of this, consider the following code: What goes into the TODO?
Source Character:
void Update() {
// ... Some process which sets the rotations on each of the character's bones.
}
Destination Character:
public class Retargeter : MonoBehaviour
{
public Avatar sourceAvatar;
public Transform sourceRootTransform;
public Avatar destinationAvatar;
public Transform destinationRootTransform;
private HumanPoseHandler sourceHandler;
private HumanPoseHandler destinationHandler;
private HumanPose humanPose;
// Use this for initialization
void Start()
{
humanPose = new HumanPose();
sourceHandler = new HumanPoseHandler(sourceAvatar, sourceRootTransform);
destinationHandler = new HumanPoseHandler(destinationAvatar, destinationRootTransform);
}
// Update is called once per frame
void LateUpdate()
{
// TODO: "Bake" the source character's bones into the muscles
sourceHandler.GetHumanPose(ref humanPose);
destinationHandler.SetHumanPose(ref humanPose);
}
}
Both characters have avatars, and this code works fine when the source character's animation is being driven by an AnimationController and a regular animation clip. It stops working if some process is setting the bones manually. I understand that there has to be some process which turns these bone transformations into muscles. Does that process exist?
I'm running into the same issue, did you find a solution for this?
I'm running into the same issue, did you find a solution for this?