Xna ModelBones - How to move them away from eachother?
Hello I know th开发者_StackOverflow中文版at one can get absolute transforms of bones in a model.. But how to move them away (like inflating) ? I think to do so, I need to move them forward to their local positions but what I have is the absolute transfoms by
Model.CopyAbsoluteBoneTransformsTo(ModelAllTransforms);
How to proceed further ? I mean I can use
mesh.ParentBone.Transform = Matrix.CreateTranslation(?) * ModelAllTransforms;
but what would be the ? sign ..
Thanks a lot! :)
The direction you're looking for is basically the local bone's absolute transform minus the center, then normalized.
Something like this:
//"time" is your timing value, "speed" is some float value
Vector3 direction = bone.Translation - center;
direction.Normalize();
Vector3 translate = time * speed * direction;
bone.Translation += translate;
精彩评论