0
現在面臨這個問題。成功地將fbx模型加載到手機7上。不幸的是,該模型似乎在屏幕上顯得過大,並且該模型的很大一部分會脫離屏幕。我懷疑可以對以下代碼進行更改,但由於我對此沒有經驗,現在我知道從哪裏開始。請指教。或者,如果我最小化fbx模型的分辨率/大小,會有幫助嗎?謝謝!如何修改變量,使fbx對象可以在手機7上查看?
// set up the "camera"
Vector3 cameraPosition = new Vector3(1, 1, 0);
Vector3 cameraTarget = Vector3.Zero;
Vector3 cameraUp = Vector3.UnitY;
float nearClippingDistance = 0.1f; // anything closer to cameraPosition than this won't be drawn
float farClippingDistance = 1000f; // anything farther from cameraPosition than this won't be drawn
float fieldOfView = MathHelper.ToRadians(45.0f); // the vertical angle the "camera" can see
float aspectRatio = (float)graphics.PreferredBackBufferWidth/(float)graphics.PreferredBackBufferHeight;
world = Matrix.Identity; // the model's transform; setting it to the identity means it will display at (0,0,0) with no rotation or scaling
view = Matrix.CreateLookAt(cameraPosition, cameraTarget, cameraUp); // put the camera at cameraPosition, looking at cameraTarget, with cameraUp as the vector pointing to the "sky"
projection = Matrix.CreatePerspectiveFieldOfView(fieldOfView, aspectRatio*40, nearClippingDistance, farClippingDistance); // defines the perspective
// set up the alternative cull mode so that our model draws properly
RasterizerState rs = new RasterizerState();
rs.CullMode = CullMode.CullClockwiseFace;
GraphicsDevice.RasterizerState = rs;
如果我需要更多信息來澄清,請告訴我。謝謝 – aHaH