I want to associate a matrix to an object in a scene. By osing this I want to be able to rotate object arount it’s LOCAL axes.
Am I starting with it properly:
1: in the beginning set matrix to Identity;
2: during redraw :
- read rates of angular and linear velocities’ changes;
- calculate 3 rotation matrices;
- multiply main matrix by above matrices expanded by adding
0 0 0 1
- add the linar velocity relative to current orientation - BUT HOW;
- convert current orientation to Euler angles - BUT I DON’T HAVE ANY LINEAR ALGEBRA MANUALS AT HAND;
- and finally glMultMatrixf(matrix);
My actual code does it ,but rotations are relative to global axes, I know the look of rotation matrices, but don’t know the order of actions, or sth. hidden in this math.
My questions are :
1: What is the order of multiplying rotation matrices so the output would be relative to previous rotation?
2: How to add linear velocities relative to orientation to main matrix?
3: How to convert matrix into euler angles?
Maybe You can point me to some easy-to-understand samles of code?