私は、骨が親骨の末尾に配置されていない親骨からオフセットされた骨を持つモデルを持っています。モデルが作成されたBlenderでは、私は骨を回転させて、付属のメッシュが正しく回転するのを見ることができます。しかし、コード内でボーンを回転しようとすると、親の末尾を中心に回転させるように見えます。私は行列の数学(私の最悪の敵)で何かを台無しにしています。XNAオフセット変換を使用してボーンを回転
更新:
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
おそらく、あなたはworldMatrixが最初に来るように、あなたの乗算の順序を変更する必要がありますか?私は確信していませんが、あなたは試すことができます – annonymously