Basically I'm trying to export a model in fbx format through the XNA content processor and I'm finding that the model itself is getting modified and being shifted slightly to the right and being scaled down a bit too. I am certain the FBX file being exported by 3D Studio Max is properly alligned at the center and of a larger scale.
If I export an FBX file with more than one mesh in it the exporter seems to work fine, so not sure what's up with that either...
*Just found that no matter what rotation/orientation I give a model XNAs content exporter seems to reset it to an identity matrix. i.e. I create a long box and give it an angle of 20degrees, XNA resets it to 0 degrees when I draw it...
THis is as it appears in 3D StudioMax: https://i.stack.imgur.com/e0oW4.png
This is how it appears in XNA: https://i.stack.imgur.com/1vOcx.png
Both are being viewed from the same angle and direction but varying distances.
Now what is really odd is if I create another mesh in max, say a box, and export that (along with the original model), it works fine: https://i.stack.imgur.com/SIDg9.png
So long as there is more than one mesh in the fbx model it draws fine, if there is less its orientation which I applied to it in 3D studio max is removed when I draw it.
Here's my code for drwaing the mesh:
model.CopyAbsoluteBoneTransformsTo(boneTransforms);
foreach (ModelMesh mesh in model.Meshes) {
foreach (BasicEffect effect in mesh.Effects) {
effect.World = boneTransforms[mesh.ParentBone.Index];
Vector3 cameraPosition = Camera.Get.Position; // new Vector3(0, 0, 0);
//cameraPosition.X = -Camera.Get.PosX;
//cameraPosition.Y = Camera.Get.PosY;
effect.View = Camera.Get.View;
// Matrix.CreateLookAt(cameraPosition, cameraPosition + Camera.Get.LookDir,
Camera.Get.Up);
effect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4
, BaseGame.Get.GraphicsDevice.Viewport.AspectRatio
, 0.01f, 1000000);
//Matrix.CreateOrthographic(800 / 1, 480 / 1, 0, 1000000);
//effect.TextureEnabled = true;
effect.LightingEnabled = true;
effect.PreferPerPixelLighting = true;
//effect.SpecularColor = new Vector3(1, 0, 0);
}
mesh.Draw();
}