0
\$\begingroup\$

I am just trying to create a movementcontroller class for game entities. These class should transform the entity affected by the mouse and keyboard input. I am able to calculate the changed rotation and the new globalPosition. Then I multiply:

 newGlobalMatrix = changedRotationMatrix * oldGlobalMatrix;
 newGlobalMatrix = MatrixSetPosition(newPosition);

The problem is that the object rotates around the global axis and not around the local axis.

I use XNAMath for the matrix calculation.

\$\endgroup\$
2

1 Answer 1

1
\$\begingroup\$

What you describe sounds like you are applying your local rotation after the global transformation has already been applied.

You need to apply the local transformation first - try flipping the order of multiplication of your matrices.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .