Goal
In my scenario, I want to achieve the equal application of an animation’s root translation to every humanoid avatar regardless of its size. For example, a child with a humanscale of 0.5 and an adult with 1.1 humanscale should be at the position 20/0/20 when i play an animation that sets the root position to 20/0/20.
Approach
I use the humanscale of each avatar, calculate the inverted scale of it and then multiply the inverted scale with the current hip position of the avatar. When I call it inverted scale I mean the following:
InvertedScale = 2 - Animator.humanscale
For example, for the child avatar: I calculate the InvertedScale (1.5) and multiply it with the current hip position, which should result in position 20/0/20.
Issue
It seems like my approach is working. However, my calculation, which I detailed in the approach, has some deviations. I tried it for multiple characters, and they are all not exactly at position 20/0/20 but have deviations up to 0.3 (i.e., 19.7 for the x-coordinate).
Maybe my approach and calculation is off, but I cannot find the mistake. I think that the humanScale is inaccurate, which results in this deviation.
Workaround
A potential workaround is to calculate the humanScale for each avatar yourself. The solution would be to apply an animation that only applies a rootmotion to 20/0/20, get the difference between the avatar’s hip position and 20/0/20, and calculate the factor.
However, that is annoying when importing other avatars at runtime. Additionally, it is only an approximation since there could be inaccuracies when the rootPosition is something like 20.000/0/20.000.
Did somebody else run into this problem?
Can you think of another approach that would solve this issue or is my approach incorrect?
Did somebody else run into this problem and has a fix for this?