DirectX 9.0c - rotations around an axis & around a point

  I have D3d working. I trying to make a car driving game and I have the four wheels. Their move is ok the front wheels rotation around themselfs is ok too. The problem is when a car moves and the wheels are turned a rotation around a point should occur (that point is between the back wheels i think). So what I'm trying to do is to rotate the wheels around that point.
   If I use the code to rotate around its own center I have no problem if I add the code to  rotate around a point, it'll rotate around that point correctly but won't rotate around itself. Insted it will rotate around that point, nomatter what. (the front wheels rotate around the point I use for simulate the rotation of the car when it was suposed to rotate around itself).
   The rotation is made every frame so I have their values on variables. I tried to change the point to zero after a rotation over a point but what happens is that the rotations doesn't happen that way.
   I've been searching for a solution on forums but they never work with both rotations at the same time. Can somebody help me???

when the rotation is around 0,0,0:
   scale
   rotate
   translate
   world=scale*rotate*translate
||The code works this way||

when the rotation is around a point:
   scale
   translate1 (to that point)
   rotate
   translate2 (back to where it was suposed to be)
   world=scale*translate1*rotate*translate2
||This only works when I rotate around a point

thnks for reading/helping ppl
Sc0rpAsked:
Who is Participating?
 
CetusMODConnect With a Mentor Commented:
Question PAQ'd
500 points refunded.

CetusMOD
Community Support Moderator
0
 
Sc0rpAuthor Commented:
I found the awnser by myself. I must:

   1º Scale
   2º Rotate around itself
   3º Translate to a point around wich I want to rotate
   4º Make the rotation
   5º Translate back to where it was (just use the simetric coordinates of the point around wich I want to rotate)
   6º Translate to where I want

   I think if I do something diferente or by another order it'll not work the right way. I hope that anyone that find this problem read this and resolve his problem ;).
0
All Courses

From novice to tech pro — start learning today.