Jump to content

Animation "loop" problem with FBX Exporter


Recommended Posts

Hey guys!  I'm trying to do some looping animations.  I've created a scene in Maya that I can export an FBX out of.  It seems like the FBXExporter isn't respecting fractional frames or something.

For the sake of simplicity, say I'm trying to move a cube on the X axis from 0 to 5 and have that loop every 20 frames.  On frame 0 and on frame 20, the X value would be at 0, but at frame 19 the frame would be at 5.  This seems fine in Maya since playback only hits the frames on the whole number, but when I export this animation via FBX to Unity for example, the animation curve is sampled between 19 and 20 and it looks like the cube flies back to 0 from 5 really fast instead of it being a "pop" back to its original starting value, which would give the intended illusion of a loop.  I've tried to remedy this by changing the last frame from 19 to 19.995, and this seems to look fine when I export and preview the animation in Unity but it still looks awkward in BJS.  I've got other animations going on in the timeline so I can't just animate a single animation cycle and then set the animation playback to loop.

The reason why I need to do this is so that I can put the timing of some animations into an animator's hands and keep them out of code land.  I realize I could say in code to just play a specific range of the animation clip and then loop it a certain number of times, but that takes the control of the timing away from the animator.  I intend to have this animation play in sync with an audio clip, so the timing is very important.

Anyone have an idea of what I could try to do to fix this problem?

Link to comment
Share on other sites

2 hours ago, steven_EXC said:

...by changing the last frame from 19 to 19.995, and this seems to look fine when I export and preview the animation in Unity but it still looks awkward in BJS.

I thought that it was a problem independent from babylon.js as well, but I began to think otherwise when I changed the difference between keyframes to be only 0.005 of a difference since it yielded different results between Unity and babylon.js.

57 minutes ago, Deltakosh said:

For babylon.js if the problem is just between the last two frames, you could probably just remove the last frame when loading animations. babylon.js will then just jump directly to frame 0

Sorry, maybe I'm not being clear.  I understand what you're saying here and this would work if I were making only a single cycle that I am then looping.  The animation loop I'm looking to create is inside of an animation curve with other animations happening at other places on the timeline.

If this were to be a single animation that I could loop over one cycle, I could animate frame 0-19 and then only play back those frames and have it loop only those frames.  What I have is an animation over 0-19, the same exact animation from 20-39, the exact same animation from 40-59, 60-79, 80-99, etc etc and then between frames 200-400 I've got an entirely different animation going on.  I could just loop the small 0-19 section for x seconds, but x seconds is going to change depending on the audio clip we need to sync our animation to.  We need to be able to hit play on the animation and the sound clip and have it line up exactly with out a programmer (me!) having to go back and change at exactly which time each animation clip is supposed to fire off each time we iterate on our audio clip.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...