XNA, C# accessing individual matrix fields?
I'm getting started with XNA and trying to access the fields (M11, M21,
etc) in a for loop, as follows.
for (int x = 0; x < 4; x++) {
for (int y = 0; y < 4; y++)
{
// Can't use array notation with this struct. Doesn't work.
matrix[x][y]
// Similar to above, but like a 2D array. Doesn't work either.
matrix[x, y]
// ERROR - I'm using a variable like a method. Doesn't work.
matrix(x, y)
}
}
So, I know I'm going to kick myself after this, but please tell me how I
can access the individual fields of an XNA matrix in order to loop through
them with a for loop. If I can do this in C++ why not in C#?
It's an example in '3D Game Programming with DirectX 11' by Frank Luna in
the matrix chapter and I want to find out more about matrices, so I'd like
to be able to do this shorthand. In the meantime I'll write it all out,
from M11...M44.
Thanks very much for your help.
No comments:
Post a Comment