How to use MD5 mesh default skeleton pose in SkeletonAnimationState

Software: Away3D 4.x

Avatar
plokk, Newbie
Posted: 24 June 2012 08:34 PM   Total Posts: 5

Hello,

I am currently experimenting on combining MD5 biped skeleton animations with software generated animations.

Loading biped animations and using them with SmoothSkeletonAnimator is easy thanks to several code examples and tutorials available.

I am currently using modified animator based on this example kindly provided by Huck: /forum/viewthread/1732/

I am able to create UserAnimator and do bone transformations in UserSkeletonTreeNode

However, I haven’t been able to figure out how to use the default pose in MD5 mesh skeleton as a starting point for transformations.

After the mesh asset loading is completed I create the SkeletonAnimationState object that is passed to the userAnimator.

var animationState:SkeletonAnimationState = (mesh.animationState as SkeletonAnimationState);

this._userAnimator = new UserAnimator(animationState);      

this._userAnimator.play(); 

What I know is when I look at animationState.globalPose.numJointPoses there is 0 jointPoses found. This is logical since there is no animation loaded - only mesh and skeleton.

When I trace joints in Skeleton asset the default joint pose information is found for every joint.

for (var f:int 0skeleton.numJointsf++) {
             
 
var raw Vector.<Number>;
 
raw skeleton.joints[f].inverseBindPose;
 
trace("Joint " ": " raw);
         

Output:

Joint 0: -1.0511376657973415e-8,-1,0.000001624773631192511,0,0.9986786842346191,7.29989650949392e-8,0.05138958618044853,0,-0.05138958990573883,0.000001623167008801829,0.9986786246299744,0,-36.06052017211914,-0.0000026358632112533087,-1.8555868864059448,1

Joint 1
: -0.04423442855477333,-0.999020516872406,0.0011065446306020021,0,0.9977037906646729,-0.044119205325841904,0.05138813704252243,0,-0.05128898471593857,0.003377128392457962,0.9986781477928162,0,-40.94342041015625,1.1858314275741577,-2.1067187786102295,1

... 

 
I might be completely lost but my idea is that I could take the joint inverseBindPose data and somehow inject that to SkeletonAnimationState.globalPose.jointPoses as a basis for my UserAnimator transformations.

It is highly appreciated if someone could point me the right direction?


-Antti

   

Richard Olsson, Administrator
Posted: 26 June 2012 09:16 AM   Total Posts: 1192   [ # 1 ]

I’m not sure how the animator you’re using is working, but the idea is that transformations in joint poses are relative to the bind transform, so if you have zero transformation in your joint poses, you should get the default pose. So, instantiate your joint poses without giving them any explicit orientation or translation and you should see the default (“bind”) pose.

   

Avatar
plokk, Newbie
Posted: 26 June 2012 10:08 AM   Total Posts: 5   [ # 2 ]

Well, basically the animator is working the same way as in Hucks example. You apply joint transformations in updatePose method found in UserSkeletonTreeNode. If no transformations are applied still no bind pose is loaded. All joints are just located in 0,0,0.

That is why I am trying to figure out a way to load the bind pose in the animator.

   

Richard Olsson, Administrator
Posted: 26 June 2012 10:22 AM   Total Posts: 1192   [ # 3 ]

I’m pretty sure that the bind pose is the default pose when no transformation is applied, so if you create a joint pose skeleton matching the original skeleton, but with all joint poses set to no transformation, you should be seeing the bind pose. Otherwise I’m not sure what could be wrong. Since you’re using Huck’s controller, I guess he’s probably the best one to answer. smile

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X