   translating and rotating in local coordinates
  ok this may be very beginner question but i tried every thing.If we rotated then translated the translation will be in the world coordinates if we applied the translation matrix first then the rotation ,we will have the translation in the rotated coordinates that's what i want but if you rotated the object after this it will rotate around the origin of the world because we applied the translation first.What i want is some thing like tomb raider where you can rotate around your self and move in the direction you are facing(in rotated coordinates) any help will be appreciable and thanks for advance.[edited by - snakekain on August 2, 2003 9:44:47 AM][edited by - snakekain on August 2, 2003 11:47:56 AM]
  no one knows any thing about that i just want to translate and rotate in local coordinates. ;  I think:1) translate to 0,0,0 (if not)2) rotate3) translate back   .lick;  Pipo DeClown own is correctTo rotate around any point you translate that point to (0,0,0)Then you do the rotation, then you translate back to that point.In the case of the object itself you translate from its position to (0,0,0), rotate, then translate back.And snakeain dont put up a message asking a question with a smiley face at 8am then post again with a frown face thinking no one wants to help you at 9am. Especially since this was only an hour difference on a saturday morning. Be patient, people here will help you =)   // Full Sail Student with a passion for games// This post in no way indicates my being awake when writing it ;  sorry for my second post and thanks for your replies.storing the translation and translating to origin then rotating then translating back is a good solution but i don''t know how can i do that translation (which i shall store) according to local coordinates god helped me to make a sin,cos approach that only applies if you rotate around negative z-axis and translating along positive x-axisD3DXMatrixTranslation(&tranmatrix,pos.x*cos(Radian(rotation.z)),pos.x*sin(Radian(rotation.z)),pos.z);where pos.x is the translating value i want along local x-axis.it worked now translation along x-axis is according to local coordinates and rotating around z-axis is working thanks to god then your solution i just want to update my translation i''ll try to do it myself but any help is appreciable.Thanks very much and sorry again ;  Wait a minute... You want your object to "translate" in the direction of its new orientation (using its new basis)?When you rotate your object, you make a rotation matrix. Let''s assume it''s rotMat. Take the 3rd row of this matrix, and that''s your lookAt vector. The vector you should move "forward" along. So if you wanted to move forward 5 units along this vector:// Assuming rotMat has already been initialized// Assuming "pos" is the position of your objectD3DXVECTOR3 lookAt( rotMat._31, rotMat._32, rotMat._33 );pos += 5 * lookAt;  Peace,Muhammad Haggag ;  What I do in that situation is take my object matrix, objmat, and do this://copy the original matriceD3DXMATRIX tmpmat=objmat;// this supplys you with the matrice necessary to place // object at (0,0,0)D3DXMatrixInverse(&invmat, NULL, &objmat);//this gives you a temp matrice at (0,0,0) regardless of any// rotations or translations that are applied to itobjmat=objmat*invmat;//here is your rotation matriceD3DXMATRIX rotmat;D3DXMatrixRotationX(&rotmat, anyvalue);//here is your original object rotated around it''s local centerobjmat=objmat*rotmat;//this places the rotated object back in world spaceobjmat=objmat*tmpmat;ALSO OF NOTE: I often do post to this board and then hang around and wait for a reply.  It seems to rarely take more than a few minutes, which is a testament to the quality of this forum.  I''ve always gotten a very competent reply, even to my dumbest questions, though sometimes it takes a while.  I have been fortunate enough to meet up with a couple of people who don''t mind receiving direct emails from me.;  Just a sidenote: You shouldn't be storing your objects in world-space. Do them in local-space, and let the world matrix transform them into world space.Peace,Muhammad Haggag   [edited by - Coder on August 3, 2003 5:00:27 PM]