对于 goBeyond 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();
}
}