PDA

View Full Version : Arcball-problem- fixed object



tito_h
06-07-2009, 10:25 AM
Hello, i have a problem concerning arcball.

I managed to implement it, and it works. But on the other hand, i wanna implement a constant object, something which is inside the arcball, but stays on his place. A rotation against the arcball rotation was my idea.

I tried this with multiplying the modelview matrix with a "reverse matrix", which i get from a quaternion from the normal arcball matrix but with the difference that i multiplied it with -1 , so that it gives you a kind of "contra-rotation" against the arcball rotation.

It works in the beginning but if i stop to drag, and i retry it, there coordinate-system seems to have changed, but only for the fixed object, the other ones which i want to rotate with arcball is working really fine.

I am sorry for the confusing description, but if somebody understand the problem, and knows a hint for me, would be great.

tia

tito_h
06-07-2009, 11:18 AM
Some might think about, why i am needing this:

I wanna combine nehes Lessen 27, with an Arcball-Interaction. Therefore i thought to get coordinates relative to the other coord-system, i need to make a rotation against a rotation, like nehe showed this in lesson 27.

Heiko
06-12-2009, 02:11 AM
If the inner object has a static orientation it has nothing to do with the arcball rotation right? What you should do is render the inner object before you start applying arcball rotation. Or if you want to render the inner object after you've rendered the arcball object:

1. glPushMatrix(); // (or your own matrix stack equivalent of pushing a matrix)
2. apply arcball rotation
3. draw object that needs the arcball rotation
4. glPopMatrix(); // (or your own matrix stack equivalent of popping a matrix)
5. draw inner object that does not need arcball rotation

In this case you don't have to worry at all about inverse rotations, etc. Or do I miss something here?

tito_h
06-17-2009, 05:40 AM
The object should look like it would be fixed:

rotatef(-w , x, y, z)
draw_object() (that should look fixed(but just because -w)
rotatef(w , x ,y , z)
draw_arc_obj() (should rotate with arcball)

I have to find a versus rotation using quaternions, because i can't sum up the rotatefs . :(