PDA

View Full Version : easy way for movements in 3D space?



09-13-2002, 05:30 AM
Hello!

Is there any OpenGL Function to create movements in a 3D space. For example by pressing the up-key the object moves into the screen and therefore gets smaller? Or do i really have to deal with math?

Thanks

Robbo
09-13-2002, 05:53 AM
Erm - simple movements like that are, well, simple. If you have a fixed camera, looking down one of the 3 coordinate axis, you simply translate all of your objects in space, towards or away from you. If you use `gluLookAt', you can of course move your `camera' and achieve the same effect.

nexusone
09-13-2002, 06:10 AM
That is called Perspective view, object just like in real life get smaller as they move away.
The is no math needed, it is all done in openGL.

But moving the object you will have to deal some with math as to location.

To move the object away from you, translate the object on the Z-axis.

code sample:

if (key == "UP_ARROW") z--; move z into the screen



Originally posted by Clouddancer:
Hello!

Is there any OpenGL Function to create movements in a 3D space. For example by pressing the up-key the object moves into the screen and therefore gets smaller? Or do i really have to deal with math?

Thanks

09-13-2002, 01:19 PM
Thank you guys!
This will surely help me out

Thanks again!

09-18-2002, 04:43 AM
Originally posted by Clouddancer:
Thank you guys!
This will surely help me out

Thanks again!

I have a problem. When I translate an object it deforms when I move near the bords.

coredump
09-18-2002, 09:00 AM
I have a problem. When I translate an object it deforms when I move near the bords.
you may have your projection messed up. post your code for setting up your projection.

[This message has been edited by coredump (edited 09-18-2002).]