Page 1 of 1

B3D cyclic animations in 1.7 or 1.6

Posted: Wed Feb 10, 2010 1:52 pm
by ragnatic
Well, back in 1.5.1 I modeled a rotating cube in Blender. I wanted a b3d file so I used gandaldf's b3d exporter. The coder warns about cyclic animation saying "I suggest you to copy the first frame to the last in way to have the model exactly in the same position". I did that and positively I had a cyclic animation in 1.5.1.

But, now in 1.7 or 1.6 that cylic animation is lost. I tried many things (like deleting that last extra frame) with no luck. In my program I can see that the last frame of the model can't show up.

Here you have the blend and b3d files in question http://www.mediafire.com/?minri2gjgyz

Posted: Wed Feb 10, 2010 2:23 pm
by CuteAlien
I think after 1.5 we had the change to a 0-based frame index for the b3d animations. So in your code you might have to change setFrameLoop.

Posted: Wed Feb 10, 2010 4:33 pm
by ragnatic
I finally got the cyclic animation by copying the first frame in the beginning of the animation and two times in the end. Something like this:

1 1 2 4 5 6 1 1

Posted: Wed Feb 10, 2010 7:05 pm
by hybrid
What's the code to set the frame loop?

Posted: Wed Feb 10, 2010 8:39 pm
by ragnatic
It's something like this

Code: Select all

       if(newframe>frame)
                    modelo_b->setFrameLoop(frame, newframe);

                else
                    modelo_b->setFrameLoop(newframe-1, frame-1);

                frame = newframe;
I need to increase or decrease one frame at a time.

Posted: Wed Feb 10, 2010 9:48 pm
by hybrid
Well, this is one weird point, but what I meant is which actual numbers do you pass to this function?

Posted: Thu Feb 11, 2010 12:44 am
by ragnatic
Ideally numbers 0 through 5 because my model has 6 frames. But with the modifications i posted i pass 1 through 6.

BTW, I got the cylic animation in the Meshviewer but not in my program.

Posted: Sun Feb 14, 2010 3:32 am
by kiwibonga
I had that issue with a walk cycle. It may be related to IPO curves, but I can't be sure.

The walk cycle basically has the same bone positions in the first and last frame... But unlike in Blender itself, it was jerky when it looped, so I tried all kinds of different setFrameLoop values, and it didn't seem to make a difference... What I had to do was not just have the first frame duplicated at the end of the cycle, but the first two frames... Now the animation is completely seamless.

i.e. instead of having:

K1, K2, K3, K4, K5, K1

I had to make it:
K1, K2, K3, K4, K5, K1, K2

Posted: Sun Feb 14, 2010 11:59 pm
by hybrid
I'd need some code which makes this problem visible.