• Create Account

# Skeletal Animation - Visualizing a Bone

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.

1 reply to this topic

### #1Slash-X  Members   -  Reputation: 125

Like
0Likes
Like

Posted 09 June 2006 - 02:19 PM

Hello everyone! For almost two months I've been trying to solve a small problem. So the situation is this, I have a hierarchy of "joints", each of them representing a local coordinate system, relative to one another (see Figure 1). Every joint has a final (global) and a relative (local) transformation matrices. The line between two joints represents a "bone" (Figure 1 - d). I need to visualize a bone using a 3-D object (for example a box (Figure 2)). The bone object needs to be positionned between the parent and child joints with correct rotation angle (Figure 3). The question is, how can I calculate the transformation matrix for the bone object with the data given? Any ideas are welcome! Thanks in advance!

### #2Endar  Members   -  Reputation: 668

Like
1Likes
Like

Posted 09 June 2006 - 09:54 PM

Here's something that I'm using. Granted, I don't have actual bone objects, but for each joint, I simply have a pointer to the parent and a list of children, and the bones are drawn between them.

This was given to me by a guy named "someusername." If you're out there, thanks.

void drawBone(	const util::CVector3d& p1, const util::CVector3d& p2, float radius,		const video::CColor& c = video::CColor(0.0f,0.0f,0.0f), float width=1.0f ) const{	m_boneDraw.generatePoints(p1.distanceBetween(p2), width, radius);	util::CVector3d localZ( p2 - p1 );	localZ.normalize();	// the direction from the start point to end point	// assuming that the up vector for the world is (0,1,0)	util::CVector3d localX;	localX = localZ.crossProduct( util::CVector3d(0,1,0) );	// find the local y axis	util::CVector3d localY;	localY = localX.crossProduct( localZ );	// create the matrix	// http://www.gamedev.net/community/forums/viewreply.asp?ID=2391549	util::CMatrix m;	// normalize, just in case	localX.normalize();	localY.normalize();	localZ.normalize();	m(0,0) = localX.x;	m(1,0) = localY.x;	m(2,0) = localZ.x;	m(0,1) = localX.y;	m(1,1) = localY.y;	m(2,1) = localZ.y;	m(0,2) = localX.z;	m(1,2) = localY.z;	m(2,2) = localZ.z;	m(3,0) = p1.x;	m(3,1) = p1.y;	m(3,2) = p1.z;			// transform so we have the right rotation, etc	m_sceneManager->getVideoDriver()->pushMatrix();	m_sceneManager->getVideoDriver()->transform(video::WORLD_MATRIX, m);	// draw the bone	m_boneDraw.render(m_sceneManager, c);	// done with drawing bone	m_sceneManager->getVideoDriver()->popMatrix();}

It does use all my object types, but it shouldn't really be that hard to figure 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.

PARTNERS