0

今この問題に直面しています。fbx モデルを電話 7 に正常にロードすることができました。残念ながら、モデルが画面上で大きすぎるように見え、モデルの大部分が画面からはみ出してしまいます。次のコードに変更を加えることができると思いますが、これについての経験がないため、どこから始めればよいかわかりました。お知らせ下さい。または、fbx モデルの解像度/サイズを最小化すると効果がありますか? ありがとうございました!

// 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;
4

1 に答える 1

0

Ok。答えを見つけました。問題はカメラの位置にあります。

Vector オブジェクトの 3 番目のパラメータを編集して、15 に変更します。

Vector3 cameraPosition = new Vector3(1, 1, 15);

これにより、カメラがオブジェクトから遠ざかり、基本的にオブジェクトが小さく見えます。

問題が解決しました。

于 2011-11-14T04:27:51.787 に答える