View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# Draw bone mesh between to joints

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

No replies to this topic

### #1Samurai Jack  Members

Posted 21 August 2013 - 06:18 AM

Hello!

I'm having a problem in OpenGL (but it does not really matter) with drawing bone mesh between two joints.

The joints are computed correctly and well placed into 3D space, but when I take 2 joints with their absolute

(world) matrices I am not able to draw a "bone mesh" between them. What I would like to achieve is something

like here:

My Idea was, to take the two absolute(world) joints (parent/child) and compute the angle between

them, set the angle and draw the bone mesh scaled to the joint. But somehow I mess it up.

Sofar I am at the stage, where I can say:

len = length(parent.xzy - child.xyz); // vector length
glPushMatrix( );
glMultMatrixf( parentWorldMatrix ); // this possition here is correct
glRotatef( ... ); // THIS IS NOT OK. Rotate to what? Atan2 ?
glScalef( len, len, len );
glBegin(GL_LINES);
glVertex3f(0, 0, 0);
glVertex3f(0, 1, 0); // y is up, is this correct? The scale should fix the length issue
glEnd();
glPopMatrix();

The direction is nowhere near i would like the bone mesh to point. Can someone please help me out?

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.