我有一个具有已翻译的从父骨(它不位于母体骨的尾部)偏移的骨模型。 在搅拌机,其中模型制成,我可以旋转骨见附件网正常旋转。 然而,当我试图在我的代码旋转骨骼,似乎将其旋转大约父的尾巴。 我在矩阵数学(我最大的敌人)搞乱的东西了。
更新:
protected override void Update(GameTime gameTime)
{
bone.Transform = Matrix.CreateFromYawPitchRoll(0f, 0.5f, 0f);
base.Update(gameTime);
}
相当标准,但如果它的事项,抽奖:
private void DrawModel(Model model, GraphicsDevice graphics, Matrix viewMatrix, Matrix projectionMatrix)
{
Matrix[] boneTransforms = new Matrix[model.Bones.Count];
model.CopyAbsoluteBoneTransformsTo(boneTransforms);
Matrix worldMatrix = orientation * Matrix.CreateTranslation(position);
foreach (ModelMesh mesh in model.Meshes)
{
foreach (BasicEffect effect in mesh.Effects)
{
effect.World = boneTransforms[mesh.ParentBone.Index] * worldMatrix;
effect.View = viewMatrix;
effect.Projection = projectionMatrix;
effect.EnableDefaultLighting();
effect.PreferPerPixelLighting = true;
// Set the fog to match the black background color
effect.FogEnabled = true;
effect.FogColor = Vector3.Zero;
effect.FogStart = 1000;
effect.FogEnd = 3200;
}
mesh.Draw();
}
}
这里的屏幕截图显示的问题http://s1231.photobucket.com/albums/ee516/Neovivacity/?action=view¤t=boneRotation.png