Math quesiton

rifter1818

Junior Contributor
Joined
Sep 11, 2003
Messages
255
Location
A cold dark place
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?
Visual Basic:
    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
 
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
 
Back
Top