View Full Version : generate a path in a 3d world

08-24-2009, 12:53 PM
Hello everyone.

I know there are topics on this but what I want is alot simpler. I have an object drawn in the distance in a 3d world, I want to generate a random path towards that object, so if you're looking straight at the screen you might zigzag towards the object and stop at the object.

How does opengl know where this object is and where the camera is?
should I even change camera positions or use gltranslate?

08-24-2009, 01:21 PM
You have to use glTranslate : translating the whole world in some direction is equivalent to translating only camera on opposite direction.
This is why OpenGL has a GL_MODELVIEW matrix : it combine "models" (the world) and "view" (the camera).

Opengl know where this object is and where the camera is ... because you specified coordinates for objects and transformations for modelview.

Lots of tutorials can be found online about this.
Look around this site :