XNA matrix order problem
Posted
by
user1990950
on Game Development
See other posts from Game Development
or by user1990950
Published on 2013-07-03T13:31:07Z
Indexed on
2013/07/03
17:20 UTC
Read the original article
Hit count: 546
I want a matrix that scales first and then rotates. I tried the code below, but it didn't work. zRotation, yRotation and xRotation are rotations that shouldn't be affected by the origin. allrot should be affected. xScale, yScale and zScale are the scaling variables. The code below works except that it rotates and then scales.
Matrix worldMatrix = (
Matrix.CreateRotationZ(MathHelper.ToRadians(zRotation)) *
Matrix.CreateRotationX(MathHelper.ToRadians(xRotation)) *
Matrix.CreateRotationY(MathHelper.ToRadians(yRotation))
) * (
Matrix.CreateTranslation(origin) *
Matrix.CreateRotationY(MathHelper.ToRadians(allrot)) *
Matrix.CreateScale(xScale, yScale, zScale)
);
© Game Development or respective owner