rifter1818 Posted November 12, 2003 Posted November 12, 2003 Ok, im pretty much a begginer at using matrix.whatever math,a begginer in 3d graphics in general but none the less i got my program semiworking. I have two functions using matrix math, Translate (vector3) and rotatey(angle) now if i say translate(vector3) and then draw the mesh it draws the mesh where i want it to, or if i say rotatey(angle) then draw the mesh it draws it at the correct angle, the problem is i want to to BOTH for the same mesh but it only does the latter, if i call Translate(vector) then Rotate(angle) then draw it only rotates or if i call Rotate then translate then draw it only translates! help me please what do i do to do both? Public Sub RotateY(ByRef angle As Single) D3DDevice.Transform.World = Matrix.RotationY(angle) End Sub Public Sub Translate(ByRef vector As Vector3) D3DDevice.Transform.World = Matrix.Translation(vector) End Sub 'seperate module For icount = 0 To numMonsters - 1 DX9.RotateY(Monsters(icount).Angle) DX9.Translate(New Vector3(Monsters(icount).x * 151, 0, Monsters(icount).y * 151)) Monsters(icount).mMesh.DrawMesh(DX9.D3DDevice) Next For icount = 0 To numCharactors - 1 DX9.RotateY(Charactors(icount).Angle) DX9.Translate(New Vector3(Charactors(icount).X * 151, 0, Charactors(icount).Y * 151)) Charactors(icount).cMesh.DrawMesh(DX9.D3DDevice) Next Quote
rifter1818 Posted November 12, 2003 Author Posted November 12, 2003 Im sorry for bothering you and then getting the answer myself, The solution was to create two seperate matricie, one with the rotation and one with the translation then multiplying them together, i figured it would be something like that but i couldnt figure it out wether it was multiply or add or a totatly different function that would combine the matricies correctly. Thank you all for you help Quote
*Experts* Nerseus Posted November 13, 2003 *Experts* Posted November 13, 2003 Don't forget to multiply them in the correct order - matrix math is not communitive. -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.