I had a quick search and I found that your matrix probably is a DX matrix:
Code: Select all
// D3DMATRIX
typedef struct _D3DMATRIX {
union {
struct {
float _11, _12, _13, _14;
float _21, _22, _23, _24;
float _31, _32, _33, _34;
float _41, _42, _43, _44;
};
float m[4][4];
};
} D3DMATRIX;
so it doesn't start with index 0, but with index 1 !!!
and because of this you'll have to decrement the indices !!!
Code: Select all
matrix4 matTransform;
matTransform(0,0) = AgentHeading.x; matTransform(0,1) = AgentSide.x
matTransform(1,0) = AgentHeading.y; matTransform(1,1) = AgentSide.y
matTransform(2,0) = Tx; matTransform(2,1) = Ty;
if you want to use the [] operator the indices are like this:
Code: Select all
(0,0) => [0]
(0,1) => [1]
(0,2) => [2]
(0,3) => [3]
(1,0) => [4]
(1,1) => [5]
(1,2) => [6]
...
(3,3) => [15]
and then your code should look like this:
Code: Select all
matrix4 matTransform;
matTransform[0] = AgentHeading.x; matTransform[1] = AgentSide.x
matTransform[4] = AgentHeading.y; matTransform[5] = AgentSide.y
matTransform[8] = Tx; matTransform[9] = Ty;