I’ve been trying to import a particular piece of animation into Playcanvas, but the animation jitters on playback.
Technically, this is just a very simple nested animation – think a sphere orbiting another sphere which orbits yet another sphere. What I get on import is objects that follow the general outline of the animation, but it almost seems like the pivot has a random jitter script applied to it that offsets the translation in a random direction by a small value.
What I’ve tried so far:
Export out of Maya 2016 as fbx (v.2012-2016), Export out of Blender 2.79. In both cases, I also tried two options: nested animation and flat (world coordinates). I’ve also tried splines, stepped keys and baking animation on every frame. All versions play fine in Maya, Blender and Unity, but they fail in playcanvas. I’ve tried to replicate the behavior on a couple simple nested cubes, but THAT plays fine in playcanvas so I’m at a loss. Has anyone come across this behavior before? I’m new to Playcanvas, but I’ve been working with anim files in Maya/game engines for years.
Ok, I think I figured out the problem and a work around.
It looks like there’s a massive bug in how playcanvas generates the animation json file.
Looking at the json file, I can see all kind of values being introduced for ‘p’, I take it that these are Pivot Rotate Translation values, or that’s what Maya calls them. If this were a Maya fbx export issue, the file would have the jitter on import back into Maya or Blender, but both instances work fine. Moreover, exporting an ascii move file out of Maya shows that these values as they should be – i.e. a single value for the entire anim range.
For now the quick fix I’ve found was to relocate the rotation pivot to the origin along with the geometry. This imports into playcanvas correctly, I just need to compensate by translating the geo back into it’s original location. The playcanvas generated json of this animation has only a single ‘p’ value, as it should.
Surprisingly, the deltas are quite large. t:0 p: [-188.668,-346.487,0], t.0.1 p: (-191.634, -335.625,0), etc…
You can examine the json file by downloading it from the test scene in the top of the thread.
Just to sum up the work around: if creating animation in Maya, make sure local pivot rotation and scale are both completely zero’d out. This is what seems to introduce errors on import into playcanvas.
I think the errors might be related to floating point calculations, per yaustar’s question. The greater the distance from origin, the greater the error.