我試圖通過使用相機創建一個等角(35度)視圖。XNA設置等距相機視圖或世界?
我畫繞Z軸旋轉的三角形。
出於某種原因,該三角形被切斷給這個結果
我計算由角度和z距離 使用本網站的相機位置的旋轉 的某一點:http://www.easycalculation.com/trigonometry/triangle-angles.php
這是我如何定義相機:
// isometric angle is 35.2º => for -14.1759f Y = 10 Z
Vector3 camPos = new Vector3(0, -14.1759f, 10f);
Vector3 lookAt = new Vector3(0, 0, 0);
viewMat = Matrix.CreateLookAt(camPos, lookAt, Vector3.Up);
//projectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, Game.GraphicsDevice.Viewport.AspectRatio, 1, 100);
float width = GameInterface.vpMissionWindow.Width;
float height = GameInterface.vpMissionWindow.Height;
projMat = Matrix.CreateOrthographic(width, height, 1, 1000);
worldMat = Matrix.Identity;
這是我如何重新計算世界矩陣旋轉:
worldMat = Matrix.CreateRotationZ(3* visionAngle);
// keep triangle arround this Center point
worldMat *= Matrix.CreateTranslation(center);
effect.Parameters["xWorld"].SetValue(worldMat);
// updating rotation angle
visionAngle += 0.005f;
任何想法我可能會做錯什麼?這是我第一次從事3D項目。
什麼是「出於某種原因,被切斷的旋轉給這個結果的某一個點」是什麼意思?我認爲你遺漏了一個字。 – 2012-08-13 00:07:41
感謝,我忘了「三角」 – 2012-08-13 01:13:43