Question

I am trying to export a 3ds animation to OpenGL and I want to go to the next frame little by little. To do that I use 3ds file with 100 keys so if I do not make mistakes it is ok.

To run my animation I use the lib3ds_file_eval statement but it seems I am doing a mistake

Here is how I do that :

void animationTimer(int value) {
    if (g_haltAnimation != 0) {
        lib3ds_file_eval(g_scenes3DS[ANIMATED_KART_ID].lib3dsfile, g_currentFrame);
        g_currentFrame = (g_currentFrame + 1) % g_scenes3DS[ANIMATED_KART_ID].lib3dsfile->frames;
        glutTimerFunc(10, animationTimer, 0);
    }
}

So it is quite simple. I put the lib3dsfile of my scene in parameter and the number of the next frame. And when I check the transformation matrix in nodes, it does not change and I can not find why.

I noticed that current_frame in lib3dsFile does not change too, I do not know if it is normal or not.

Was it helpful?

Solution

It is normal behaviour that current_frame in the file does not change. However the matrices of at least some nodes should change for a non-trivial animation.

Did you check the nodes by doing the following?

for (Lib3dsNode* p = g_scenes3DS[ANIMATED_KART_ID].lib3dsfile->nodes; p != 0; p = p->next )
{
   // check p->matrix here
}

Make sure to check every matrix because some (most?) nodes probably won't move in a kart animation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top