hog Posted December 13, 2003 Posted December 13, 2003 Does anyone have any pointers, help on how to rotate in 3d? Problem: I have a square made of 2 primitives and can successfully display them with a texture of a walking man. I want to be able to simply rotate the square clockwise but can't seem to suss it. The SDK help is of little or no use??? Quote My website
Darc Posted December 14, 2003 Posted December 14, 2003 you need to use Matrices, d3dDevice.Transform.World = RotateY(angle) d3dDevice.Transform.World = RotateX(angle) d3dDevice.Transform.World = RotateZ(angle) Those will rotate the object around the origin but they are absolute in that if angle doesn't change, neither will the rotation, so do something like: Public Const Speed As Long = 2000 'Decrease SPEED to go faster Dim angle As Single = PI / SPEED Private Sub DoMatrices() d3dDevice.Transform.World = Matrix.Identity d3dDevice.Transform.World = Matrix.RotateZ(angle) angle += PI / SPEED End Sub now just call that everytime before you draw :) Quote
hog Posted December 14, 2003 Author Posted December 14, 2003 Nice:) A great sample, thnx Darc Quote My website
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.