Rotation 3D with mouse

Hello,

I'm using DirectX 9 to develop a simplex 3D application. In particular, I show in a PictureBox my 3D object and I would like to use the mouse to rotate it.

Actually, with the PictureBox "MouseMove" event I read the e.X and e.Y coordinates and simply I transform it in rotation:

mRotX = Matrix.RotationX((e.Y / Velox))

mRotZ = Matrix.RotationZ(-(e.X / Velox))

mRotT = Matrix.Multiply(mRotX, mRotZ)

device.Transform.World = mRotaT

But this is not properly the effect that I would like to obtain, because it is true that moving the mouse on the PictureBox my 3D object rotates but the system is not to much friendly.

Do some one know how can I obtain a much real effect For example as in normal 3D application (such as 3DStudio Max).

Thanks very much.

Igor




Answer this question

Rotation 3D with mouse

  • Sam_res03

    Hi

    Have you investigated moving the camera around the mesh/scene as opposed to applying a transformation

    If this is a technique you can utilise, I'd recommend you take a look here http://viewport3d.com/trackball.htm

    I appreciate this particular post is about WPF, but theres a detailed walk through of the theory and you can download a trackball class and easily customise it for working with DirectX (WPF uses the same apis).

    If you need more information, try searching if "virtual trackball" and directx.

    Slightly off topic, this is probably not the most appropriate forum to post your question in ... perhaps you might find better guidance in the DirectX forums

    Good luck

    Richard


  • gooon

    Hi Richard,

    thank you very much for your help. I'll follow your suggestins.

    Bye.

    Igor



  • Rotation 3D with mouse