I see what you mean... It is not a bug. Ok, let me explain it again. Here goes....
Remember I told you about the rotation order is X -> Y - > Z? You get the conclusion of
"if you rotate the object with yrotate (y space axis) a following rotation with xrotate rotate the object around the x axis of the object itself, not around the x space."
is totally consistent with my explaination of rotation. Why is this happening? Let us concern with only X and Y rotation, shall we?
1. You need to keep in mind that no matter what is the current orientation of an object, or how far you had rotate it, DBpro will just keep the value of the XYZ rotation without actually applying the rotation on the object until SYNC command is called.
1. When the SYNC command is called, the object rotation will ALWAYS start at (0, 0, 0). And then DBpro will create the rotation matrix based on the rotation values associated with the respective object.
2. Since the rotation angle starts at (0, 0, 0), the object's local axes will be simillar (or parallel) to the world axes. (You can change this, thru using PIVOT OBJECT or when you model it, though I doubt you did in this case.)
3. Remember that X rotation will always get executed first, even if you issue Y ROTATE OBJECT first.
4. Due to this, no matter how you rotate Y axis, it seems as though as the X rotation is always rotating around the object local X axis. (Recall that X get rotated first, and before the rotation is applied, object's local X axis is parallel to the world X axis.)
Hmmm... I think it is as clear as mud.
Perhaps an example will help, again, let just concern ourself with X and Y rotation is enough.
1. Let's say I Yrotate the object at the angle 45. As expected, the ship is now turning right for 45 degrees.
2. In my main loop, I also put a IF statement to check whether the user press certain key, if it is pressed, I Xrotate the object at angle 45.
3. If the user didn't press anything, the ship will always pointing 45 degrees to the right.
4. As soon as the user hit the key, voila, the ship is now pointing 45 degrees to the right, will tilting up the nose by 45 degrees! It seems like the Xrotate is rotating around the ship's local X axis.
EXPLAINATION:
- During step #1, DBpro recorded the ship's rotation state as (0, 45, 0).
- Thus everytime SYNC is called, the ship will initially at its original state at rotation (0, 0, 0). Then it creates the rotation matrix based on the current rotation state. The rotation matrix will based on XYZ rotation order. You can think this more like, everytime when SYNC is called, each object will initially at its original rotation state, then DBpro apply the X rotation -> Y rotation -> Z rotation.
- During step #4, as soon as the user hit a key, DBpro update the ship's rotation state as (45, 45, 0)
- Now, if you understand what I am talking about until now, you will shoud out loud "BINGO!". As you can see here, the object will now rotate at X angle 45 degrees from the original state, thus tilting the nose up. Then follow by turning to the right 45 degrees.
- The reason why you think X rotate is on its local axis is because X angle always get rotated first, and at the object original state, the object's local axes is parallel to the world axes.
Phew... I don't even know what I am talking about. I doubt you will. I wonder why I am writing this. Hmmm....
Bad Nose Entertainment - Where games are forged from the flames of talent and passion.
http://www.badnose.com/