Animation Root Rotation: Preview vs. Game

Hi all

My question upfront: what are the ways the animation preview window can differ compared to the game regarding root motion?

I’ve put together an animation system using the playables API, an empty animator being the output node:

I am using its root motion via script…

…which simply says:

    private void OnAnimatorMove()
    {
        animator.ApplyBuiltinRootMotion();
    }

It was more complex, but I am trying to find the answer to my question above.

Now, the animation that I am using is simply prone turn from Mixamo (Humanoid) that in the animation preview window looks like this:

3903748--332419--prone right turn preview window.gif

But in the game, it jumps back after 55 frames (its length):

3903748--332422--repeating rotation.gif

Its average angular Y speed is 23.9 deg/s as per the importer and it has a root rotation:

Now my question: why does the preview window show me a repeating animation, but the game does not when using ApplyBuiltinRootMotion? What does the preview window do differently than the function? My assumption was that the root translation and rotaton would be applied to the (soldier’s) transform and when it repeats, it would continue applying it so that it would not jump back. What confuses me most is that it simply works for the preview window (when I select the clip and press play on the preview window).

Note: I have been using 2018.3 and 2019.1, latest, each.

Many thanks in advance for any help or pointers where to look! Happy to provide more info
Florian

I’ve now tried drawing gizmos as follows:

    private void OnDrawGizmos()
    {
        Gizmos.color = Color.red;
        Gizmos.DrawLine(transform.root.position + transform.forward * 1f, transform.root.position + transform.forward * 2f);
        Gizmos.DrawCube(transform.root.position + transform.forward * 1f, new Vector3(.1f, .1f, .1f));
    }

This shows me that the root rotation changes ever so slightly during the animation, while the soldier as a whole rotates:

3907486--332917--Kapture 2018-11-19 at 22.34.58.gif

Sorry about the blinking (2019.1.0a9 on OSX).

This leads me to believe that the animation does not correctly encode root motion (root rotation changes slightly, and I assume the “rotation” is encoded in the relative movement of the bones).

However, I am still wondering how the preview window manages to correctly rotate the avatar and chain the animations…? (I’d love to be able to do that myself – is it cheating and not rotating back the avatar at the end of the animation?)