Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted
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
  • *Experts*
Posted

Don't forget to multiply them in the correct order - matrix math is not communitive.

 

-Nerseus

"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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...