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
This is a discussion on Moving objects in 3d(x,y and z ) within the Game Programming forums, part of the General Programming Boards category; Hi please i need your help guys, i am trying move my models around 3d space, i need ideas on ...
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
What, you mean "add a number to the coordinate"?
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.
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.
any ideas on how i can do this.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.
thanks for your help
i want to be able to move 6 of my models individually in x ,y and z axisWhat, you mean "add a number to the coordinate"?
using c++ and opengl
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.any ideas on how i can do this.
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.