Results 1 to 7 of 7

Thread: Most common way to move around in a 3D world?

  1. #1
    Member Newbie
    Join Date
    Jul 2009
    Posts
    33

    Most common way to move around in a 3D world?

    I am into doing my first 3D world and I wonder what is the most common way to move around in it. Is it by rotating the environment by calling glRotate*() or is it by changing the gluLookAt() or a combination of them both?

  2. #2
    Senior Member Frequent Contributor scratt's Avatar
    Join Date
    May 2008
    Location
    Thailand
    Posts
    555

    Re: Most common way to move around in a 3D world?

    I'd recommend you perhaps look at some tutorials like NeHe's, and build a camera class of some sort.

    If you fancy delving a little deeper I'd recommend learning about Quaternions right now and basing your rotations on those.. It will require some head-scratching now, but will save a lot of head-scratching later down the line..

  3. #3
    Senior Member Regular Contributor
    Join Date
    Feb 2004
    Posts
    248

    Re: Most common way to move around in a 3D world?

    gluLookAt is just an utility function and is equivalent to glMultMatrixf(), glTranslate() etc.

    In OpenGL the "camera" (so-called) is always fixed in the origin and the scene has to be moved accordingly.

  4. #4
    Member Newbie
    Join Date
    Jul 2009
    Posts
    33

    Re: Most common way to move around in a 3D world?

    Oh ok, so it dosnīt matter if I use gluLookAt() or glTranslate() to move around? No one is better than the other? Or is it in some cases?

  5. #5
    Senior Member Regular Contributor
    Join Date
    Jun 2009
    Location
    FL , USA
    Posts
    192

    Re: Most common way to move around in a 3D world?

    In some cases moving camera is better. The quaternions help in this case as it provides you free rotation.

    Ex1: 3D First Person Shooter games prefer camera motion.

    Ex2: A large scene where activities are going recommend object motion.

  6. #6
    Member Newbie
    Join Date
    Jul 2009
    Posts
    33

    Re: Most common way to move around in a 3D world?

    Quote Originally Posted by awhig
    Ex1: 3D First Person Shooter games prefer camera motion.
    So in this case the quaternions are to prefer. I have read on quaternions on Wikipedia and just want to check if I have unsterstood it - in this case a quaternion is the "free space" where objects are in?

    Quote Originally Posted by awhig
    Ex2: A large scene where activities are going recommend object motion.
    Here the camera is fixed and the objects are moving through a call to glTranslate*()?

  7. #7
    Senior Member Regular Contributor
    Join Date
    Jun 2009
    Location
    FL , USA
    Posts
    192

    Re: Most common way to move around in a 3D world?

    Q1. Yes. Quaternion is useful for providing free space rotation because it is a hypercomplex number and is in a way 4D vector. You can use glRotatef() but for complex rotations, the rotation matrix computation is expensive.

    Ex: If you rotate around X ,then Y then Z , the total rotation matrix will be R = RzRyRx. In case of quaternion you have one vector only and changing components mean changing direction.It is compact. Wolf3D imo uses glRotatef where as Quake series use quaternions. So you can judge yourself.

    Best way to understand quaternion is to take a sphere and then reach at any point using quaternion and using rotation matrix. The latter is sometimes hard to compute and get precise directions.The precise directions can be achieved through quaternion using slerp where as it is harder to achieve (sometimes) with matrix multiplication.


    A2. Yes. Objects can rotate too.

    A quaternion is generally associated with camera.

Similar Threads

  1. Most common Vulkan mistakes vs. the world.
    By Alfonse Reinheart in forum Vulkan
    Replies: 7
    Last Post: 05-26-2016, 09:46 AM
  2. Rotations and Transformations, Move the player or move the world?
    By neurocase in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 01-14-2014, 12:41 AM
  3. Common function mod()
    By mmoerth in forum OpenGL: GLSL
    Replies: 0
    Last Post: 04-19-2006, 09:13 AM
  4. Common/Common-Lite Query Mechanism?
    By don in forum OpenGL ES
    Replies: 2
    Last Post: 08-19-2003, 10:40 AM
  5. Move the camera, or the world?
    By SuperFly in forum OpenGL: Advanced Coding
    Replies: 12
    Last Post: 11-02-2000, 04:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean