In a 3d space I have a 3d object which I am rotating using a transformation matrix. The transformation matrix is 4x4 but I am just using the rotation part of the matrix. I want to add constraints to the rotation for example the object can only rotate in the z direction for 20 degrees. I know the following but when I add manual constraints such as angle cant be larger than 20 i get scaling and skewing in my object.
To summarize my question how can I add constraints to a transformation matrix?