A linear combination of X, Y, and Z, for each of X, Y, and Z.
You need to crack open a good intro to 3D graphics book and read up on matrices. I don’t understand several of your questions.
Also, to one of your previous questions expressing puzzlement as to whether to use row or column vectors:
1 0 0
You can use either, but because you’re trying using OpenGL (which is column-major operator-on-the-left – i.e. Mv1=v2), and you’re probably trying to use it from C/C++ (which is row-major), then you want to use the row-major operator-on-the-right convention in your code (v1M=v2). This implies row vectors.
However, given some random matrix of values like the above, the provider needs to tell you which conventions is being followed. It could be either, and if you presume incorrectly, you’ll just get garbage.
If we presume operator-on-the-right convention (v1*M=v2), then you can see that the local X axis v1=(1,0,0,0) maps to v2=(r00,r04,r08,0) in the destination space. This may answer one of your other questions.
A solution which might be easier than messing around with the orientation matrix is to order your GL calls as follows -
glTranslate (xo, 0.0, 0.0);
Where R is your orientation matrix and xo is the distance
you want to move the object along it's X axis. Is there a
reason you can't take this approach?
the camera is calculated by doing the same but in inverse.
so i’ve seperated the global coordinates and the rotation out of convenience.
hope that clarifys a bit, my problem is that when the object is doing a local motion it must account its rotation, so that if viewed from the object it will look like its moving 1 step in x-axis, but when viewed by others it will look like its moved in the direction it was rotated to.
no that looks more like multiplication of a vector with a matrix, it doesnt make sense im my case.
my problem is to translate localmotion into globalX, globalY, and globalZ.
everyobject has a globalX,globalY and globalZ
i’ve almost made it work with, but it’s slightly wrong when the object is rotated at certain angles.
globalX += r00 + r04r08; //i just guessed this code by
globalY += r01 + r05r09; //trying to reason what the
globalZ += r02 + r06*r10; //rotationMatrix really means.
reasoning for my guessing is that let’s say the object is not rotated at the moment then it would have a rotationMatrix with the values:
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
and if we moved 1 step in x-axis
globalX += 1 + 00 = 1
globalY += 0 + 10 = 0
globalZ += 0 + 0*1 = 0
the result is that the globalX changed +1 and the other didnt change at all, which is the wanted result that fits for this rotationMatrix but not some of the others
i want to create a 3D world where every object and the camera to have its own globalPosition and localRotation, and i want every object and the camera to be able to move according to their localRotation. Just like in reality.
How do you guys do it?
oh i just tried using just
globalX += r00;
globalY += r01;
globalZ += r02;
this works perfectly with any kind of rotation for the camera but doesn’t work for the objects when they’ve been rotated over 2 axises or more. very odd that it works perfectly for the camera but not the objects. for the objects its completly wrong