中的模型轉換之後檢索模型位置,該模型位於here,位於012Be14NoXNA教程提供的方法中,如果我可以檢索模型正在繪製的新位置,將所有轉換應用到目。我已經編輯了一些我需要的方法。有沒有人知道我可以做到這一點的方式?在應用XNA
public void DrawModel(Camera camera)
{
Matrix scaleY = Matrix.CreateScale(new Vector3(1, 2, 1));
Matrix temp = Matrix.CreateScale(100f) * scaleY * rotationMatrix * translationMatrix * Matrix.CreateRotationY(MathHelper.Pi/6) * translationMatrix2;
Matrix[] modelTransforms = new Matrix[model.Bones.Count];
model.CopyAbsoluteBoneTransformsTo(modelTransforms);
if (camera.getDistanceFromPlayer(position+position1) > 3000) return;
foreach (ModelMesh mesh in model.Meshes)
{
foreach (BasicEffect effect in mesh.Effects)
{
effect.EnableDefaultLighting();
effect.World = modelTransforms[mesh.ParentBone.Index] * temp * worldMatrix;
effect.View = camera.viewMatrix;
effect.Projection = camera.projectionMatrix;
}
mesh.Draw();
}
}
您可以在http://gamedev.stackexchange.com/上找到更多答案。 – rcdmk