Thread: Moving objects in 3d(x,y and z )

  1. #1
    Registered User
    Join Date
    Jul 2011
    Posts
    4

    Moving objects in 3d(x,y and z )

    Hi
    please i need your help guys, i am trying move my models around 3d space, i need ideas on how i can implement this...i have implemented picking, what is left is to figure out a way to move the objects individually in x,y and z axis..

    thank you

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    What, you mean "add a number to the coordinate"?

  3. #3
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    You need to perform a transformation from local / model space to world space. This transform usually involves scale, rotation, and translation but can also incorporate orbit.

    The pipeline is usually ISROT or SRT for a transform where I is either Identity or the parent transformation matrix. In order to move objects along axes you will either have to maintain the right, look, and up axes for objects or you will extract these from your final transformation matrix. The matrices in question differ depending on the 'handedness' of your coordinate system. There are several sources on the internet as well as books that cover all this information in great detail.

    If you have a camera class you can almost use it for the orientation of your objects except that the final matrix must be transposed for objects. As well you will not need to maintain the view/projection matrix in the class that handles object orientation.

  4. #4
    Registered User
    Join Date
    Jul 2011
    Posts
    4
    sorry i forgot to tell you i was using c++ and opengl, there are not to many tutorials on this subject or the ones i find are two complex that i cant really understand, do i need to create a camera class? is there any alternative method, i read somewhere about using gluUnProject and gluProject, but i am not sure how this is done.
    You need to perform a transformation from local / model space to world space. This transform usually involves scale, rotation, and translation but can also incorporate orbit.
    any ideas on how i can do this.

    thanks for your help

  5. #5
    Registered User
    Join Date
    Jul 2011
    Posts
    4
    What, you mean "add a number to the coordinate"?
    i want to be able to move 6 of my models individually in x ,y and z axis

    using c++ and opengl

  6. #6
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    any ideas on how i can do this.
    Yes, I do. However giving you the explanation here will not only lead to more questions since you won't understand it but will also not help you b/c I gave you enough info to go and research it for yourself. What you have asked here could fill up one or two chapters in a 3D math book.

    Read up on:
    • Vectors and the operations you can perform on/with them
    • Matrices and the operations you can perform with them and their mathematical properties
    • A typical 3D transformation pipeline
    • The differences between local/model, world, view/camera, and screen space.


    Incidentally I'm not an OGL man but those functions obviously will project coordinates into space and unproject them. That has nothing to do with moving objects. You will need to use glTranslatef.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Moving Objects in D3D?
    By VertexBuffer in forum Game Programming
    Replies: 3
    Last Post: 01-18-2007, 04:21 AM
  2. moving objects in a window
    By axr0284 in forum Windows Programming
    Replies: 1
    Last Post: 02-26-2006, 07:23 PM
  3. moving objects
    By condorx in forum Game Programming
    Replies: 2
    Last Post: 02-22-2002, 02:05 PM
  4. moving objects in d3d...
    By Unregistered in forum Game Programming
    Replies: 1
    Last Post: 01-09-2002, 04:07 PM
  5. Moving Objects on the Screen
    By BigSter in forum C++ Programming
    Replies: 6
    Last Post: 12-02-2001, 10:37 PM