Sign in to follow this  
TSquirel

Modify Arcball Rotation

Recommended Posts

TSquirel    100
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this