Models from 3ds max lose their transformations when input into XNA

Posted by jacobian on Game Development See other posts from Game Development or by jacobian
Published on 2012-10-09T21:17:09Z Indexed on 2012/10/14 3:52 UTC
Read the original article Hit count: 210

Filed under:
|

I am making models in 3ds max. However when I export them to .fbx format and then input them into XNA, they lose their scaling.

-It is most likely something to do with not using the transforms from the model correctly, is the following code correct

-using xna 3.0

        Matrix[] transforms=new Matrix[playerModel.Meshes.Count];
         playerModel.CopyAbsoluteBoneTransformsTo(transforms);
        // Draw the model.
         int count = 0;
        foreach (ModelMesh mesh in playerModel.Meshes)
        {

            foreach (BasicEffect effect in mesh.Effects)
            {

                effect.World = transforms[count]*
                    Matrix.CreateScale(scale) *
                     Matrix.CreateRotationX((float)MathHelper.ToRadians(rx)) * 
                    Matrix.CreateRotationY((float)MathHelper.ToRadians(ry)) * 
                    Matrix.CreateRotationZ((float)MathHelper.ToRadians(rz))*
                    Matrix.CreateTranslation(position);


                effect.View = view;
                effect.Projection = projection;

                effect.EnableDefaultLighting();
            }            

            count++;
            mesh.Draw();
        }

© Game Development or respective owner

Related posts about XNA

Related posts about 3dsmax