Game Development Reference
In-Depth Information
2
3
1000
0100
0010
t x
4
5
t y
t z
1
The code is also simple.
public void SetTranslation(Vector translation)
{
_m41 = translation.X;
_m42 = translation.Y;
_m43 = translation.Z;
}
public Vector GetTranslation()
{
return new Vector(_m41, _m42, _m43);
}
The scaling matrix is also quite easy to understand. Remember, each row re-
presents an axis. The first row of the matrix can be thought of as a vector. This
vector is the X axis of whatever is being scaled; the greater its X x dimension the
greater it's scaled in that direction. The second row is the Y axis, the third row is
the Z axis, and they too can be thought of as vectors. If each of the vectors has a
length of 2, then the object is scaled uniformly along each axis.
2
3
S x 000
0 S y 00
00 S z 0
0001
4
5
public void SetScale(Vector scale)
{
_m11 = scale.X;
_m22 = scale.Y;
_m33 = scale.Z;
}
Search WWH ::




Custom Search