FBX Wheel Rotation Anomaly

I ran into this problem while working on a project that had train wheels rotated by an associated FBX animation. So I figured I’d share what I found out.

The anomaly was that the wheels were rotating backwards. At first I thought that maybe it was a stroboscopic illusion, but that wasn’t the case. The wheels were really rotating backwards.

The animation was super simple two keyframe change in pitch. After a series of experiments in a test project, I determined that if the pitch changed by more than 60 degrees in one frame worth of time, the direction of rotation gets reversed by PlayCanvas. At 60 degrees rotation and below per frame, PlayCanvas gets the rotation direction correct.

I verified that the FBX files were exported with the correct rotation by viewing them in Microsoft’s 3D viewer app and also by re-importing the FBX back into Lightwave 3D.

I figured out the threshold by making a super simple project and importing different FBX animations. I cleaned it up and it is available for poking around here:
https://playcanvas.com/editor/scene/846280

To see the issue, select the wheel object and then simply click on the tiny “play” icon for the animation you want to run that is in the Animation/Assets list for the wheel object. The animations are named for their degrees of rotation per original animation frame. The source Lightwave animation has two keframes - one at “0” and another at “20”. The animation was baked so that the FBX has a keyframe for each frame.

This is an easy issue to work around to get the speed that you want so long as you are aware of the problem up front. But it had me stumped for a little while. Hopefully this post will make it easier for the next person who bumps into this.