Hello,I am not sure if this is the correct place to post this after all its really not an opengl question but I am using opengl to display. I am working on a project that takes a .3ds character file in and uses a .bvh animation with one frame for the skeleton. I attach the the mesh objects to the skeleton. This all works great, Now I load a bvh file and play it by applying the tranformation and rotation part of the motion. the skeleton moves as I would expect but the mesh objects do not . So here are the details. To rotate the bone I only need the parents offset then I apply the parents rotation, but for the mesh object 0,0,0 is between the characters feet so the joint location can only be calculated based on the hierarchy of the bone offsets by adding the offset of each bone traversing backwards through each parent I can get the position of the joint that effects the mesh object. If I subtract the this position for each vertex in the mesh then I have translated to 0,0,0 this actually works however if I apply the same rotation matrix that i applyed to the bone and add the new bone location back to the mesh vertex I get my mesh objects spinning around the joints in a hap hazard fashion. Here is the code

CSkeleton::transformMeshBones(CBVHAnimation *bvhAnimation ,int frame){
	CMotion motion;
	CBone *bone;
	CBone *parent =  NULL;
	CVector offset;
	CQuaternion rotation;
	CVector pos,parentpos;
	CMatrix rotationMatrix,parentRotationMatrix;
	motion = bvhAnimation->m_motion_frames[frame];
	CPivotPoints *pp;
	for(int x = 0;x<  motion.m_motion.size();x++){
			CVector newPoint;
			bone =  bvhAnimation->m_bones[x];
			rotation =  motion.m_motion[x];
			rotationMatrix = rotation;
			offset = bone->getOffset();
			pp = m_vector_pp[x];
			parent = bone->getParent();
			if (parent){
				//Transform position if the object has a parent: 
				//Note parent must have been transformed first
				//Get the parent rotation matrix
				parentRotationMatrix = parent->getRotationMatrix();
				//get the parents position
				parentpos = parent->getPosition();
				//get the bone offset
				pos = offset ;
				//multiply the bone offset by the rotation matrix
				//add the parents position
				pos += parentpos;
				//set the bone position
				if (bone->m_has_position){
					pos.x = motion.m_position.x + offset.x;
					pos.y = motion.m_position.y + offset.y;
					pos.z = motion.m_position.z + offset.z;
					pos.x = 0.0; pos.y = 0.0; pos.z = 0.0;
			newPoint = pos+m_translation;
			LMesh *mesh = pp->getMesh();
			CQuaternion v;
			//translate rotate   mesh
			for(int index =0;index<mesh->GetVertexCount();index++){
				v = mesh->GetVertex(index);
				v -= pp->getCurrentPP();
				v *= rotationMatrix;
				v += newPoint;

This is a tough one and I would greatly appreciate any help.

Thank You :slight_smile: