examples/js/libs/ColladaLoader.js
function flattenSkeleton(skeleton) {

		var list = [];
		var walk = function(parentid, node, list) {

			var bone = {};
			bone.name = node.sid;
			bone.parent = parentid;
			bone.matrix = node.matrix;
			var data = [ new THREE.Vector3(),new THREE.Quaternion(),new THREE.Vector3() ];
			bone.matrix.decompose(data[0], data[1], data[2]);

			bone.pos = [ data[0].x,data[0].y,data[0].z ];

			bone.scl = [ data[2].x,data[2].y,data[2].z ];
			bone.rotq = [ data[1].x,data[1].y,data[1].z,data[1].w ];
			list.push(bone);

			for (var i in node.nodes) {

				walk(node.sid, node.nodes[i], list);

			}

		};

		walk(-1, skeleton, list);
		return list;

	}
function flattenSkeleton(skeleton) {

		var list = [];
		var walk = function(parentid, node, list) {

			var bone = {};
			bone.name = node.sid;
			bone.parent = parentid;
			bone.matrix = node.matrix;
			var data = [ new THREE.Vector3(),new THREE.Quaternion(),new THREE.Vector3() ];
			bone.matrix.decompose(data[0], data[1], data[2]);

			bone.pos = [ data[0].x,data[0].y,data[0].z ];

			bone.scl = [ data[2].x,data[2].y,data[2].z ];
			bone.rotq = [ data[1].x,data[1].y,data[1].z,data[1].w ];
			list.push(bone);

			for (var i in node.nodes) {

				walk(node.sid, node.nodes[i], list);

			}

		};

		walk(-1, skeleton, list);
		return list;

	}
function flattenSkeleton ( skeleton ) { var list = [ ] ; var walk = function ( parentid , node , list ) { var bone = { } ; bone . name = node . sid ; bone . parent = parentid ; bone . matrix = node . matrix ; var data = [ new THREE . Vector3 ( ) , new THREE . Quaternion ( ) , new THREE . Vector3 ( ) ] ; bone . matrix . decompose ( data [ 0 ] , data [ 1 ] , data [ 2 ] ) ; bone . pos = [ data [ 0 ] . x , data [ 0 ] . y , data [ 0 ] . z ] ; bone . scl = [ data [ 2 ] . x , data [ 2 ] . y , data [ 2 ] . z ] ; bone . rotq = [ data [ 1 ] . x , data [ 1 ] . y , data [ 1 ] . z , data [ 1 ] . w ] ; list . push ( bone ) ; for ( var i in node . nodes ) { walk ( node . sid , node . nodes [ i ] , list ) ; } } ; walk ( - 1 , skeleton , list ) ; return list ; }
Walk the Collada tree and flatten the bones into a list, extract the position, quat and scale from the matrix
Walk the Collada tree and flatten the bones into a list extract the position quat and scale from the matrix