
hi, after i add the tree into the game just follow by the steps at home page,then i run the game, the tree is always turning itself by yaxis....it's so strange...is there something wrong with the matrix?.how can i solve this problem...?thx...



It sounds like you set the world, view, projection matrices wrong, but it's hard to tell from your post. The latest release is for XNA 3 so if you are using XNA 4 some things
might not be working  I haven't used XNA 4 myself so I don't really know what changes have been made.
Doublecheck your matrix math, and if you can't make it work, try asking for help on the XNA forums.



Thx,but i use XNA3.1,is it the problem?



No 3.1 should be fine. My guess is that your world or view matrix is wrong. Note that the leaves are billboards so they are supposed to rotate, but the trunk should be stationary.



I write the code like this(i draw the trunk first, when i run the game the trunk always turning by itself and the tree's position change with the camera when player move ,I my really dont know how to set the view matrix...very sad...could
you help me...):
Matrix worldMatrix = Matrix.Identity;
Matrix worldTranslation1 = Matrix.CreateTranslation(new Vector3 (0.0f,0.0f,0.0f));
Matrix worldRotation = Matrix.CreateFromYawPitchRoll(MathHelper.TwoPi, MathHelper.TwoPi, MathHelper.TwoPi);
Matrix worldScale = Matrix.CreateScale(0.0003f);
worldMatrix = worldScale * worldRotation * worldTranslation1;
Vector3 position1, view1, up1;
position1 = new Vector3(0.0f, 0.9f,0.0f);
view1 = new Vector3(0.0f, 0.9f, 0.5f);
up1 = new Vector3(0.0f, 1.0f, 0.0f);
Matrix viewmatrix1 = Matrix.CreateLookAt(position1, view1, up1);
Matrix projectionMatrix1;
projectionMatrix1 = Matrix.CreatePerspectiveFieldOfView(MathHelper.Pi / 4.0f,
(float)1024 / (float)768, 0.005f, 1000.0f);
TreeProfile profile1 = Content.Load<TreeProfile>("Trees/Pine");
SimpleTree tree1 = profile1.GenerateSimpleTree();
tree1.DrawTrunk(worldMatrix ,viewmatrix1 ,projectionMatrix1);
//tree1.DrawLeaves(world1, cam.viewmatrix1, projectionMatrix1);



The view and projection matrix should come from your camera, and the world matrix comes from your tree's position in the world. In the above code, the tree's rendering is independent of any camera info so it will appear at exactly the same place on the screen
at every frame.
If the concept of world,view,projection matrices confuses you, I suggest you follow some more XNA tutorials and samples. There are some great samples on the XNA website.

