You need to keep around the components of how you built your world matrix to begin with.
Say your world matrix is for a spinning coin. So, it has rotate, scale, then translate in that order.
Let's assume you're using row-major matrices. You'd form your forward transformation matrix as:
matrix = rotate(30,60,90) * Scale(5) * Translate ( 5, 0, 0 )
Form the backwards (inverse) transformation as just the opposite operations, in the opposite order.
inv_matrix = Translate( -5, 0, 0 ) * Scale( 1.0/5.0 ) * TRANSPOSE( rotate(30,60,90) )
So note a few things:
- inverse of rotation matrix ("unrotate") is just its transpose. (this is a special property of rotation matrices only and doesn't apply to other matrix types)
- inverse of scale matrix (unscale) is 1/scale
- inverse of translation matrix is applying -translate