# XNA and Matrix.<whatever>

I am not new to XNA 2D programming, but have never done 3D. I am interested in learning, but always get lost once I get to creating a Matrix.

I am sad to say that I don't really get them. Can someone explain, (or even just point me to a good tutorial) on getting started with matricies?

I understand them from a math point of view, but I don't really get the API. How do you use the API? What is the difference in CreatePerspecitive, and CreatePerspectiveFieldOfView. I am really looking for information in understanding when to use the different members the API provides.

I know this question is a little vague, and large, so I will try to edit it as needed.

-
possible duplicate of What is a good linear algebra book for game programmers? –  user744 Jul 12 '11 at 13:18
I'm not asking for the math behind it, I asking on how to use the API –  Joe Jul 13 '11 at 16:26

Not sure which aspects of Matrix math you're having difficulties with, so I'll list two books that helped me get over the 3D math hump. Chances are, you'll need to work through more than one book to get everything to finally "click".

1. 3D Math Primer for Graphics and Game Development This is a great book, everything is explained thoroughly and in a language that's easy to understand. I would start here.
2. Mathematics for 3D Game Programming and Computer Graphics Another good 3D math textbook. Covers a wide range of material. It's concise and straight to the point.

I would start with these, even if you have to re-read the material a couple of times. I spent months going over 3D math topics before being comfortable with it.

EDIT: I posted this before you updated your question. If you're looking for help directly with how to use Matrices in XNA, check out XNA Game Studio 4.0 Programming: Developing for Windows Phone 7 and Xbox 360 by Tom Miller & Dean Johnson (can't link, due to spam prevention, but it's on Amazon). Chapter 4 goes into the very basics of 3D Math and directly relate to the math classes in XNA. You'll probably learn a lot from the code samples in the later chapters as well.

EDIT 2: Another book that I recommend as well is Microsoft XNA Game Studio Creator's Guide. While this only covers XNA 3.0, the majority of it is still applicable to XNA 4.0. It not only has a chapter on Matrix math, but on creating a graphics engine camera system that shows great use of Matrices in XNA. I think you'd take away a lot from that sample.

-
awesome, I'll check it out. Here is the link for lazy people like me :) amazon.com/XNA-Game-Studio-4-0-Programming/dp/0672333457 –  Joe Jul 11 '11 at 20:41
Amazon link to the Microsoft XNA Game Studio Creator's Guide book. amzn.com/0071614060 –  Neeko Jul 11 '11 at 21:42

I found that Riemers 3D XNA tutorials were great for picking up the basics on the matrices and how to use them specifically in an XNA environment. The second tutorial makes a simple flight-sim so it also has a fair amount of instant gratification.

Here's a link to the first one, the navigation links are on the right side (something that threw me at first): http://www.riemers.net/eng/Tutorials/XNA/Csharp/series1.php

-
Just as a warning, I don't know if the tutorials have been updated for XNA 4.0 yet or not. –  Lunin Jul 11 '11 at 21:29
They have been updated to XNA 4. –  DMan Sep 18 '11 at 16:30

I wrote a tutorial to specifically help with this :-) It explains the concepts using Sunburn for XNA.

http://dsebj.evolvingsoftware.com/?p=211 [Matrix Math is Hard?]

-