0
我有一個小的代碼庫,您可以在my current commit on GitHub處看到完整的代碼。我會盡力把相關的代碼放在這裏。基本上,如果我移動改變世界矩陣的三角形Position
,它就變得不可見。有任何想法嗎?MonoGame 3D - 三角形在中心Y <約-2.0時不可見
GraphicsDevice.RasterizerState.CullMode = CullMode.None;
this.vertices = new[]
{
new VertexPositionColor(new Vector3(1.0f, -1.0f, 0.0f), color),
new VertexPositionColor(new Vector3(-1.0f, -1.0f, 0.0f), color),
new VertexPositionColor(new Vector3(0.0f, 1.0f, 0.0f), color)
};
this.effect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4,
device.Viewport.AspectRatio, 0.001f, 50.0f);
this.effect.View = Matrix.CreateLookAt(Position, Vector3.Down, Vector3.Forward);
this.effect.World = Matrix.CreateTranslation(entity.Position);
foreach (var pass in this.effect.CurrentTechnique.Passes)
{
pass.Apply();
this.device.DrawUserPrimitives(PrimitiveType.TriangleList, this.vertices,
0, 1);
}