PDA

View Full Version : moving elements



kuh
12-03-2004, 04:53 AM
could somebody tell me how to simply move an element (square, etc.) up, down, left, right?
is there anything simple like rotatef() ? :( :rolleyes:

vamsee kanth
12-03-2004, 06:55 AM
yes it is there.

it is glrotatef(angle,x-axis,y-axis,z-axis);

angle is the angle of rotation.

x-axis=1.0 rotate along x-axis,0.0 donot rotate along x-axis.

similarly y and z.

it is as simple as that.

Jan
12-03-2004, 07:06 AM
I think, what you wanted to know was

glTranslatef (x, y, z);

Jan.

kuh
12-03-2004, 07:41 AM
Thanks a lot, but I guess I explained it wrong.
Drawing is not the problem. I am trying to make some animation with a temporization. Example: I drew a robot. Now I want to make it walking. I can raise a leg, swing an arm, but how do I get the whole thing to move left, when moving the legs?

Silkut
12-03-2004, 08:03 AM
finally your question is "how to implement the perpetual movment of walking"

zukko
12-03-2004, 03:31 PM
try:
glTranslatef(x+leg,y,z);
leg is also controlling the leg movement

12-06-2004, 09:35 AM
Post the code so we can se what you are trying to do

kuh
12-07-2004, 08:11 AM
the code is too long. why doesn't anybody understand?
I am trying to slowly move an object from one place to another AFTER it has been drawn.

imagine a bee fying by, a car moving forward, that kind of thing.

zukko
12-08-2004, 07:17 PM
as i get it you can do this:

glTranslatef(x,0,0);
draw_car();
x+=0.2f;

that will move the object, or try explaining it better....