I'm using XNA and am having a simple issue which I can't figure out. I'm just messing around and want to get a firm grasp of local/world space coordinates.
Matrix rotateCharacter= Matrix.CreateRotationZ(MathHelper.ToRadians(45.0f));
Matrix moveCharacter = Matrix.CreateTranslation(new Vector3(10,10,0));
Matrix multMat =Matrix.Identity * rotateCharacter * moveCharacter ;
Matrix WorldToB = Matrix.Invert(multMat);
Vector2 worldCoord = new Vector2(10, 10);
Vector2 worldToB = Vector2.Transform(worldCoord, WorldToB);
So all I'm doing here in my example is initially rotating my sprite's local axis around the world origin and then translating it out into world space. Thus, a world space coordinate of something like (10,10) would be 0,0 (my pixel's starting coordinate) in the local space (worldToB should be (0,0)). However, this is not occurring I guess as my inverted matrix is incorrect. Can anyone give me an answer of what I'm doing wrong exactly?