Archived

This topic is now archived and is closed to further replies.

element2001

How do you rotate about 2 different pivot points?

Recommended Posts

I have dice in a game and I''m currently rotating them about the origin in order to show the right face of the die and to simulate tumbling. But I also want to be able to move the ''camera'' as it were. So I need to then change the die''s rotation pivot point to elsewhere. Is this possible?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Hmm, could you repeat ?

Rotating around 2 different pivots at the same time ? If the rotation axis is not coincident to the line that connects both pivots in R3, then that''s physically impossible (it would rip your object apart...)

Share this post


Link to post
Share on other sites
Maybe he means that he first want to translate and rotate the dice to a certain position in his scenario, maybe among with some other objects, and then rotate the whole thing (the dice AND everything else, thus everything as one object) to make a certain camera-position.

I for myself am a bit busy programming a small 3D-engine, but I''m still thinking how about how to do this (without haveing to calculate the rotations myself if possible), thus if anyone can tell me how, I''d be very happy with that.

Share this post


Link to post
Share on other sites
Yes Nali, that is what I mean. Basically I need to be able to change the point at which the object rotates. So i rotate it about the origin (that works) then need to rotate it about a different point (not working). I tried glulookat but that isn''t working quite right either. It''s kind of hard to explain what is going wrong when I try to use glulookat. I guess it is something you''d have to see to understand why it isn''t working.

I''ll work on it some more and if I still can''t figure it out then I''ll post the code on a website so someone can try it out n fiddle with it. Thanks for tryin to help.

Share this post


Link to post
Share on other sites
hmm my tired brain came up with this:

function draw()
glRotatef(around the objects origin)
glTranslatef(to wherever)
glRotatef(camera''s rotations)
end

basically if you want to rotate an object around a point above it, then translate that object down and rotate? it would seem this is what you are after?

im probably missing something important though, you all wouldnt have missed this...

Share this post


Link to post
Share on other sites
Sorry, i did a really poor job of explaining what I was trying to do. I have a table, a board, and dice. The board and table move together when the camera moves so we can consider them one thing. The dice however tumble from the rear of the table to the front. The tumble rotations are fine, but the angle at which the table is to the viewer must be followed by the dice, or they end up going thru, or floating above the table.

So when the dice tumble from the rear of the table to the front, they must do so on an angle. Hence the need for that rotation. Well suffice it to say I actually figured out a workaround, using tangent to form an incline plane path (table angle to viewer''s eyes). It''s really not easy for me to explain this without you seeing it in action.

Thanks for all the reply''s. The camera does not have 6 degrees of freedom nor do I think I''ll bother to make it so. It just works enough to do what I intended. If anyone wants the code to follow the angled plane (table) let me know.

Share this post


Link to post
Share on other sites