Overriding Mecanim Animations in LateUpdate
Using the LateUpdate()
method, I get severe jittering which shows I am not using it correctly. A possible reason might be Update()
and LateUpdate()
outcomes are fighting each other...
Basically, I animate a Unity mecanim character by getting its latest motion data first:
void Update()
{
Vector3[] latestPositions;
Quaternion[] latestOrientations;
GetLatestPose(out latestPositions, out latestOrientations)
updateActor(currentPose, latestPositions, latestOrientations);
updateModel(currentPose, targetModel);
}
Now, I would like to override the animations for left & right hands, so I wrote:
private void swapAnims(Quaternion[] rotationsArray)
{
Quaternion temp = rotationsArray [(int)HumanBodyBones.LeftHand];
rotationsArray [(int)HumanBodyBones.LeftHand] = rotationsArray [(int)HumanBodyBones.RightHand];
rotationsArray [(int)HumanBodyBones.RightHand] = temp;
}
Finally, in my LateUpdate
:
void LateUpdate()
{
swapAnims(latestOrientations);
updateActor(currentPose, latestPositions, latestOrientations);
updateModel(currentPose, targetModel);
}
Could someone please help me understand LateUpdate()
properly, and also what I am doing wrong here?
Your answer
![](https://koobas.hobune.stream/wayback/20220612050434im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Memory leak and Allocation 18 Answers
how to create a transition on mecanim using unity editor for linux 0 Answers
Problem with Mecanim sprite animations on a fast paced game. 0 Answers
Weird bug about flipX being stuck 2 Answers
is it possible to convert generic animations to humanoid ones? 1 Answer