Rotate/Translate object in local space
        Posted  
        
            by 
                Mathias Hölzl
            
        on Game Development
        
        See other posts from Game Development
        
            or by Mathias Hölzl
        
        
        
        Published on 2012-11-27T15:36:51Z
        Indexed on 
            2012/11/27
            17:21 UTC
        
        
        Read the original article
        Hit count: 448
        
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.
© Game Development or respective owner