0

こんにちは、カメラとモデルのローテーションで頭痛の種です。カメラは機能しているようですが、モデルの回転が台無しになっているようです。私が欲しいのは、モデルがその場で少し回転することですが、回転して円を描いて移動しているようです。これが私のコードです。右を押すと、フロート角度が 0.05f ずつ増加し続けます

描画機能:

        Vector3 cameraRotate = Vector3.Transform(offSetVector, Matrix.CreateRotationY(angle));
        Vector3 cameraLookat = cameraPos + cameraRotate;
        Matrix viewMatrix = Matrix.CreateLookAt(cameraPos ,  cameraLookat, Vector3.Up);
        float aspect = GraphicsDevice.Viewport.AspectRatio;
        Matrix projectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, aspect, 0.1f, 200.0f);
        carTypeOneMatrix = Matrix.CreateTranslation(pos) * Matrix.CreateRotationY(angle);        
        baseModel.Draw(carTypeOneMatrix , viewMatrix, projectionMatrix);
4

2 に答える 2