Animation discrepancy between animation editor and in-game playback

I made an animation using the animation editor and noticed that when I play it in-game it looks wrong.

This is how it looks in the animation editor:

And this is how it looks in-game

This bug occurs both in studio playtest mode and in live games.

If you would like to see it for yourself:
repro.rbxl (78.8 KB)

  1. Open the rig with the animation editor and observe the SwordAttackRight animation.
  2. Upload the animation from game.ServerStorage.RBX_ANIMSAVES.Rig.SwordAttackRight and set workspace.Rig.AnimationPlayer.Animation.AnimationId to that id.
  3. Run the game and observe the animation looking weird.

Expected behavior

I expect the in-game animation to look the same as how it looks in the animation editor.

2 Likes

This is just an acknowledgment announcement!

We’ve filed a ticket to our internal database, and we’ll follow up when we have an update!

Thanks for the report!

1 Like

You need more keyframes, because animations always try to get to the next keyframe with the shortest path. Since rotation is Euler Angles in Roblox, this doesn’t always translate that well.

Animation editor must have some extra info or something because it always goes the path I intended and not the shortest.

1 Like

I imported the published animation into moon animator out of curiosity - it plays the animation correctly just like the regular animation editor.

Maybe this is a case of the default animation script playing alongside your animation? Be sure to check the keyframes and animation priority of your swing animation.

1 Like

Reproduces for me. I even tried with :Play(0) and :Stop(0)

The interpolation for animation editor must be different from the interpolation for engine animations.

Hi there, thanks for your report !

As of today, this is expected behavior. This discrepancy is due to an optimization made on the engine side for runtime playback of animations. In the Animation Clip Editor, the code displaying the motion will interpolate the two rotations within the keyframes using what’s called “Spherical Linear Interpolation” (Slerp), which will follow the shortest path between two rotations. At runtime, this interpolation is approximated as a “normalized linear interpolation” (Nlerp) to improve performance.

As a workaround, you can manually place intermediate keyframes between the two to reduce the error incurred by this approximation.

2 Likes

Thanks for the explanation! Would it be possible to make it so that Slerp is used instead of Nlerp when the animator is either in your character or is close to you?

unrelated but I’ve noticed a strange discrepancy on animations when they are on a rig using AnimationControllers versus when on a rig using Humanoids, rotation is correct but transformation/translation is significantly lessened on rigs with AnimationControllers. Is there a reason for this?