Extracting orientation:Quaternion and translation:Vector3D from SkeletonJoint’s inverseBindPose

Software: Away3D 4.x

mataps, Newbie
Posted: 20 April 2013 07:43 AM   Total Posts: 9

Hello away3d team,

I dont know where I should post this so I posted it in the user’s discission and here. Anyway here’s my problem. Im trying to animate my md5 mesh manually, as my starting point I want to copy the SkeletonJoint’s orientation and translation to JointPose, but I came accross the issue where I could’nt find anything useful from SkeletonJoints properties. So my initial thought is that SkeletonJoints stored the orientation and translation in the inverseBindPose property, but when I tried to decompose it my model got screwed. Im not very good in Math and English so I think it’s better if i show off my code smile.

private function onAssetComplete(event:AssetEvent):void
{
 
if (event.asset.assetType == AssetType.ANIMATION_SET)
 
{
  animationSet 
event.asset as SkeletonAnimationSet;
  
  
//build the animator
  
animator = new SkeletonAnimator(animationSetskeleton);
  
  
//build the skeletonPose for custom animation
  
skeletonPose = new SkeletonPose();
  
  
//create a jointPose for each joint ( clone :D );
  
for(var i:int 0skeleton.joints.lengthi++)
  
{
   
var jointPose:JointPose = new JointPose();
   
jointPose.name skeleton.joints[i].name;

   var 
matrix3D:Matrix3D = new Matrix3D();
   
matrix3D.copyRawDataFrom(skeleton.joints[i].inverseBindPose);
   
matrix3D.invert();
   var 
decomposedMatrix:Vector.<Vector3D> = matrix3D.decompose(Orientation3D.QUATERNION);
   
   
jointPose.translation.copyFrom(decomposedMatrix[0]);
   
jointPose.orientation.fromMatrix(matrix3D);
   
   
skeletonPose.jointPoses.push(jointPose);
  
}
  
  
//create a new clip and add it to animationSet
  
var skeletonClip:SkeletonClipNode = new SkeletonClipNode();
  
skeletonClip.stitchFinalFrame true;
  
//add 2 frames since it will throw an error only 1 frame is added
  
skeletonClip.addFrame(skeletonPose1000);
  
skeletonClip.addFrame(skeletonPose1000);
  
skeletonClip.name "myAnim";
  
//finally add the clip to the animationSet :)
  
animationSet.addAnimation(skeletonClip);
  
  
mesh.animator animator;
  
animator.play("myAnim");
  
 
}
  

I’ve searched google and other posts and I always find people struggling on this king of issue but nothing works for them. Hope that you will kindly answer my question. Thanks :D

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X