Sign in to follow this  
mike74

BVH nightmare

Recommended Posts

I'm trying to write a BVH file loader to get my feet wet with skeletal animation, and I'm having a lot of trouble getting it working. I can get the skeleton to draw, and he moves around a little bit. However, the motion just isn't right. I must be doing the angles or something wrong. Please let me know if you see anything obviously wrong with the drawing code: struct Joint { char name[80]; float offset[3]; int numchannels; vector<Joint> v; }; void drawwell(Joint j) { vector<Joint>::iterator iter = j.v.begin(); int fctr = mikectr % frames.size(); if (j.numchannels == 3) { glPushMatrix(); glRotatef(0, 0, 1, frames[fctr][globalctr]); glRotatef(1, 0, 0, frames[fctr][globalctr+1]); glRotatef(0, 1, 0, frames[fctr][globalctr+2]); glTranslatef(j.offset[0], j.offset[1], j.offset[2]); glBegin(GL_POINTS); glVertex3f(0, 0, 0); glEnd(); globalctr+=j.numchannels; while (iter != j.v.end()) drawwell(*iter++, 0, 0, 0); glPopMatrix(); } else { // this is for the root node globalctr+=j.numchannels; glPushMatrix(); glRotatef(0, 0, 1, frames[fctr][globalctr+3]); glRotatef(1, 0, 0, frames[fctr][globalctr+4]); glRotatef(0, 1, 0, frames[fctr][globalctr+5]); glTranslatef(j.offset[0], j.offset[1], j.offset[2]); glBegin(GL_POINTS); glVertex3f(0, 0, 0); glEnd(); while (iter != j.v.end()) drawwell(*iter++); glPopMatrix(); } } Mike C. http://www.coolgroups.com/zoomer/

Share this post


Link to post
Share on other sites
It appears the angle is actually the first argument to glRotatef.

No wonder there was so little movement.

Mike C.
http://www.coolgroups.com/zoomer/

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this