开发者

Xna ModelBones - How to move them away from eachother?

开发者 https://www.devze.com 2023-04-07 21:09 出处:网络
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 lo

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;
0

精彩评论

暂无评论...
验证码 换一张
取 消