PDA

View Full Version : Help me!

Fernando
02-19-2002, 06:11 PM
Hi People!

I want to do a thing that isn't that easy for me to explain!

I'm from another Country, and I'll do the best of me trying to clearify my question. :-)

The case is. I have for example two QUADS. Let's say they are in different positions.
Then, I remove the first QUAD, and after this, I translate and rotate the other QUAD. How Do I Do if I want that the QUAD 1 reappear in the same position it was before, in relation to the QUAD 2?

Could anyone help me??
Thank you guys!

SKA
02-19-2002, 07:07 PM
I beleave your question is not clear. If you use glPushMatrix, glPopMatrix your problem could be solved. Other way is you rotate the quade from the orgon and then translate it back to origon.

Fernando
02-19-2002, 07:55 PM
Thank you SKA! But It's not what I want!! :-)

I'll try to explain my question again. I Think the final were confused.

Imagine a First Person Game. Also Imagine that we have only two CUBES (it's only an example), and the player can Walk and rotate in all of three axis = x, y, z.

Remember that when we translate and rotate things, it's not the camera that moves, but who moves is the objects.

So, with this in mind, let's think the difference from the first CUBE to the second is of 3 meters. Then, I destroy the first CUBE, losting all the data and variables it have.

After, I Walk and Rotate a little.
How Do I Do now, if I want to Load a new CUBE in the same position the FIRST CUBE had in relation to the SECOND CUBE?? If I had only positioned it would be a easy work, because all that I would do is to get the position of the SECOND CUBE and subtract 3. But in this case, I did some rotations. So, when I load the new object, it'll have to stay in the same angle that it have before (in relation to the SECOND CUBE)...

Thank you again guys!!!!! Any help will be apreciated! :-)

jide
02-19-2002, 10:29 PM
I'll try to help you, i think i understood what you want.

So, you've got one quad in a pos: posa.
you've got one other quad in a pos: posb.
you have dpos= posa-posb.
is that right ?
so, keep in memory dpos, and then place yourself in the system coordinate of the first quad, then move to -dpos, then draw your quad !!