0

I am very new to XNA, and I try to load a model, but it is not loaded properly.

The model looks like this in visual studio:

enter image description here

And it looks like this when I try to display:

enter image description here

My code is this:

        Matrix[] transforms = new Matrix[BilliardTable.Bones.Count];
        this.BilliardTable.CopyAbsoluteBoneTransformsTo(transforms);

        foreach (ModelMesh mesh in this.BilliardTable.Meshes)
        {

            foreach (BasicEffect effect in mesh.Effects)
            {
                effect.EnableDefaultLighting();
                effect.World = transforms[mesh.ParentBone.Index] *
                    Matrix.CreateRotationX(120)
                    * Matrix.CreateTranslation(Vector3.Zero);
                effect.View = Matrix.CreateLookAt(balls.First().cameraPosition,
                    Vector3.Zero, Vector3.Up);
                effect.Projection = Matrix.CreatePerspectiveFieldOfView(
                    MathHelper.ToRadians(45.0f), balls.First().aspectRatio,
                    1.0f, 10000.0f);
            }
            mesh.Draw();
        }
dvjanm
  • 2,351
  • 1
  • 28
  • 42
  • I downloaded another model and it shows up properly. I don't know why it is not work with this model. – dvjanm Oct 07 '13 at 08:23
  • Did you create this model? – Neil Knight Oct 07 '13 at 12:53
  • No, I found this on the internet. Why? – dvjanm Oct 07 '13 at 18:23
  • Just out of curiosity, if you take out `Matrix.CreateRotationX(120) * Matrix.CreateTranslation(Vector3.Zero);`, does it show up any better? And fyi, if you are replying to another user, you should put @name so that the user gets a notification that you replied to their comment. – davidsbro Oct 09 '13 at 23:40
  • @davidsbro: Sorry, but have deleted this and I don't know where it was downloaded from, but I think you can be right about taking out those so if I have time I will research this model and try if it works. – dvjanm Oct 10 '13 at 11:05

0 Answers0