Jump to content
  • Advertisement
Sign in to follow this  

Modify Arcball Rotation

This topic is 2545 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi to all,

I need some help with the CModelViewerCamera class in DirectX. I have a terrain model that I want to rotate using the CModelViewerCamera class. The CModelViewerCamera class uses the Arcball class to get the rotation parameters from the mouse input. The rotation the Arcball sends back is calculated from a Quaternion and does a rotation on all 3 axis of the model. I would like to use the standard CModelViewerCamera class but only adapt it to only rotate my terrain model around one axis on the centre of my model.

Practical example would be to get a rotation just like a clay pot spinning on a pottery wheel while you are seated next to it looking at the centre of the spinning pot.

The effect I want is a model that rotates around the vertical axis pointing up when the user moves the mouse from left to right on the screen, like a turn table spinning a clay pot. And then when the uses moves the mouse in a top to bottom motion on the screen the model will tilt on a horizontal axis paralleled to the screen to give an effect like when you would stand up or sit down keeping your eye on the spinning clay pot.

The spinning effect I think comes from my world matrix and the up and down movement comes from moving the camera (view matrix) while keeping it focused on the centre of the model.

I'm pretty sure most of the changes happens in the FrameMove procedure, but I'm not sure how to work with the Quaternions to get the rotations I need and were to apply them. Could anybody please help me or give me some pointers on how to change the standard CModelViewerCamera class to that I get this type of rotation from it?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!