• Create Account

#ActualNercury

Posted 26 February 2013 - 04:28 PM

So i mantain,say,a 4x4 matrix to store the object's orientation and displacement , edit that matrix to rotate/move the object, and glRotate,glTranslate accordingly before drawing the object?

Look into my previous post's history, it may give you some ideas.

Thanks, that helped

So is the following correct?
So If i want to move an object to the direction it's facing, since i don't have a "forward" vector explicitly,
i assume that all objects begin facing a certain direciton.

For example -Z direction, and the current direction they're facing is [0 0 -1]^T times their rotation matrix?

Is this how it's done generally?
If so, isn't it processor-intensive to compute all orientations from this?

If ^ meant transformation by matrix, then yes. Let me iterate to avoid any error:
If you want to move, lets say, a camera -Z units back (in it's rotated state), you simply transform this movement vector (0, 0, -1) by camera's current rotation matrix, and just do pos += that_vector.

pos += vec3(0, 0, -1) ^ rotation; // ^ == transform

I have no idea "how it is done", I find this easy for me and just try to minimize the amount of things I do . Ok, I started by modding Unreal so I guess I got some concepts in my head from that.
As for performance, I think this kind of operation goes like butter in C++. It is bunch of additions and multiplications.

#2Nercury

Posted 26 February 2013 - 04:27 PM

So i mantain,say,a 4x4 matrix to store the object's orientation and displacement , edit that matrix to rotate/move the object, and glRotate,glTranslate accordingly before drawing the object?

Look into my previous post's history, it may give you some ideas.

Thanks, that helped

So is the following correct?
So If i want to move an object to the direction it's facing, since i don't have a "forward" vector explicitly,
i assume that all objects begin facing a certain direciton.

For example -Z direction, and the current direction they're facing is [0 0 -1]^T times their rotation matrix?

Is this how it's done generally?
If so, isn't it processor-intensive to compute all orientations from this?

If ^ meant transformation by matrix, then yes. Let me iterate to avoid any error:
If you want to move, lets say, a camera -Z units back (in it's rotated state), you simply transform this movement vector (0, 0, -1) by camera's current rotation matrix, and just do pos += that_vector.

pos += vec3(0, 0, -1) ^ rotation; // ^ == transform

I have no idea "how it is done", I find this easy for me and just try to minimize the amount of things I do
As for performance, I think this kind of operation goes like butter in C++. It is bunch of additions and multiplications.

#1Nercury

Posted 26 February 2013 - 04:17 PM

So i mantain,say,a 4x4 matrix to store the object's orientation and displacement , edit that matrix to rotate/move the object, and glRotate,glTranslate accordingly before drawing the object?

Look into my previous post's history, it may give you some ideas.

Thanks, that helped

So is the following correct?

So If i want to move an object to the direction it's facing, since i don't have a "forward" vector explicitly,

i assume that all objects begin facing a certain direciton.

For example -Z direction, and the current direction they're facing is [0 0 -1]^T times their rotation matrix?

Is this how it's done generally?

If so, isn't it processor-intensive to compute all orientations from this?

If ^ meant transformation by matrix, then yes. Let me iterate to avoid any error:

If you want to move, lets say, a camera -Z units back (in it's rotated state), you simply transform this movement vector (0, 0, -1) by camera's current rotation matrix, and just do pos += that_vector.

pos += vec3(0, 0, -1) ^ rotation; // ^ == transform


PARTNERS