This project is read-only.

Affecting single bone scale during runtime?

Aug 10, 2010 at 9:12 PM

Hi all,

So after reading a few articles here and other forums, I have generated the following code:

int noseB = avatar.SkinnedModel.SkeletonBones["noseBridge"].Index;

avatar.AnimationController.SkinnedBoneTransforms[noseB] = Matrix.Invert(avatar.SkinnedModel.SkeletonBones[noseB].InverseBindPoseTransform)  

                 * avatar.AnimationController.SkinnedBoneTransforms[noseB]  

                 * Matrix.CreateScale(10)                    

 * avatar.SkinnedModel.SkeletonBones[noseB].InverseBindPoseTransform;


As you can surmise, I'm trying to allow users to deform their characters face to anything they want. In the code above I'm trying to get the index of the "noseBridge" bone, then modify the scale of the bone from 1 to 10. Later on in the code, I'm using the standard foreach loop through the SkinnedModelBasicEffects which references this updated Matrix and sends info to the shader.

It's not working at all. When called, this function does nothing. Any ideas / suggestions?



Aug 11, 2010 at 12:06 AM

Ok, so regardless of what I set the AnimationController.SkinnedBoneTransforms[index] to, nothing changes. This is because the SkinnedBoneTransforms[int index] is only an accessor method.  It cannot set the variable skinnedBoneTransforms[index].  Why I'm not getting compile-time errors, I don't know, but I now know why this method doesn't work. Anybody else got an idea for a work around?