   Cube Rotation Around x and y NOT z axis
  HiMy Cube Step 1: start.......up..............left..center..right.......down.............Step 2: x axis rotation 90 deg.......back.............left..up..right............center.............Step 3: y axis rotation 90 deg "ERROR" it starts rotate around Z axis!........right............back...up....center...........left...........!My wish is to have!:Step 3:.......back..............down....left..up............center.............How to avoid this phenomena? (I'm using DX)THX   
  are you meaning to rotate about the object's local axis or an axis parallel with the world axis?  I believe you'd get what you're seeing if you're rotating about local axis.-me   ;  You want Tait-Bryan coordinates, where you rotate in the next step around the NEW axis, not the original axis. You probably also want to google "Gimball lock."To represent orientations (rotations) I recommend using quaternions, or possibly rotation matrices, not Euler angles. In D3DX, there are rotation functions to set up heading/pitch/roll, which might also help you.;  Palidine: Yes I realize that, but what should I do to avoid this?hplus0603: tried quatrnions and yawpitchroll with no luck...   ;  There are many coordinate spaces going on here.Let P be the current object-position.  (P*(0,0,0) maps to the object position)Let C be the object-description.Let O be the current object-orientation.  (O*C rotates the object C to the current orientation of the object)Let "`" (backtick) be the "inverse operator".Let R be a rotation.What you appear to be doing is, taking:P*O*C(the object C rotated by the orientation O, then moved by the translation P)and rotating it like:P*O*R*O`*P`*P*O*C(translate it back and unrotate it by it's current orientation, then apply your rotation, then reorient it and move it back to it's current location).ie, you are rotating it in "object local orientation and coordinates".What you want to do is rotate it relative to your world orientation:P*R*P`*P*O*CThis may or may not be a wise thing to want to do, but it is what you said you wanted to do.  :)Another way of looking at it...Suppose every object has 3 components.(Model, Orientation and Position)When you rotate the model, you have to decide which way you want to rotate it.  Given a rotation R, you can set it's components to any of the following:Model, R*Orientation, PositionModel, Orientation*R, PositionModel, Orientation, R*PositionModel, Orientation, Position*RModel, R*Orientation, R*PositionModel, R*Orientation, Position*RModel, Orientation*R, R*PositionModel, Orientation*R, Position*Ror you could even change the model:R*Model, Orientation, Positionbut I would advise against that.And then you can invert your rotation on some components, you can rotate both the model and the position, you can...All of these cause "rotation like behaviour".  Some of them are far more insane than others.  :)In this scheme, the difference between rotating in world and object local orientation is the difference between:Model, R*Orientation, PositionModel, Orientation*R, Position;  WOW! It looks like You know what You writingSadly I don't know exactly what I'm reading...Can You help me convert P*R*P`*P*O*C to fit my DX needs?;  Rotate it around the z instead of the y, it looks like, when you did the x-rotation you rotated the axis.   ;  Same effect with Z rotation.I just create Rotation with YawPitchRoll function(matrix or quaternion)and than multiply by the matrix.   ;  Sorry mate -- I know 3D math, not 3D APIs.From the one's I've seen coworkers play with, you end up producing a transformation matrix for the position of each object.  It is possible to extract a translation and rotation matrix from these transformation matrixes, at least using math -- and probably using the 3D engine's API.So, I'd advise:1> Find out how to get the transformation matrix for your object.2> Find out how to extract the translation and rotation components of this matrix.3> Find out how to invert and apply the position component seperately.Currently, your object's transformation matrix (T) is:T:=P*Oyou want to change it to:P*R*P`*T = P*R*P`*P*O = P*R*OHow your API deals with transformation matrixes is something I have no clue about.  :)[Edited by - NotAYakk on June 7, 2006 4:53:11 PM];  Try rotating it around the z then x, it might turn out to be x then y.   