md2 animation

Started by
12 comments, last by ff8 17 years, 5 months ago
Quote:Original post by Evil Steve
Going by your code above, you're not interpolating between animation frames, you're just skipping from one frame to the next. What you should be doing is lerping the vertex positions between the two positions, so at the start of frame 0, the vertices are at the positions defined by frame 0, halfway through they're halfway between frame 0 and 1, etc.

no he isn't.
	if (elapsedTime >= (1000.0f / kAnimationSpeed) )	{		pModel->currentFrame = nextFrame;		lastTime = time;	}

He only updates the frame every x amount of milliseconds
Advertisement
Quote:Original post by ComradeBG
...
the problem is that elapsedTime and lastTime are giving the times for one model and i have to have these 2 variables separate for every separate model
i tried to put them in the model structure info but it didn't work =/
What didn't work about it? How did you go about doing that? You're right that that is your problem (or at least one of them) since elapsedTime and lastTime are static variables of that function. In your current design they should be member variables of the class so that each instance has it's own elapsedTime and lastTime.
Thanks for the replies guys, I solved this problem
but now it appeared another :
when I enable OpenGL lighting, the models' textures disappear
what could causes this?
My projects: https://sourceforge.net/projects/monstersmash/
if the texture becomes same as the light's color then check if the normals are normalized.
take care.

This topic is closed to new replies.

Advertisement