OpenGL Aviation coordinates(NED) to OpenGL

This topic is 2612 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I'm working with an sensor board , similar to WII remote. It gives 3D rotation( attitude) with respect to NED ( North East Down ) which means body (aircraft) nose is +X , right wing is +Y , down to earth is +Z.
OpenGL uses Up Y coordinate system( Both can be seen in attached image).I get euler angles(roll, pitch, yaw) from sensor board. see here Sensor video & code .
If i set upvector (0,0-1) in glLookAt function, the coordinate system becomes Towords Viewr +X, Left +Y , Down +Z. Then i will construct Rotationmatrix (- Roll, -Pitch, Yaw) .
//---------------------------------------------------------------------------------------------------------------

void RotationMatrix (dMatrix3x3 &A, double r, double p, double y)
{
// Order (ZYX)
double sx = sin®, cx = cos®;
double sy = sin(p), cy = cos(p);
double sz = sin(y), cz = cos(y);
A[0][0] = cy*cz; A[0][1] = sy*sx*cz - sz*cx; A[0][2] = sy*cx*cz + sz*sx;
A[1][0] = cy*sz; A[1][1] = sy*sx*sz + cz*cx; A[1][2] = -cz*sx + sy*cx*sz ;
A[2][0] = -sy; A[2][1] = cy*sx; A[2][2] = cy*cx;
}
//--------------------------------------------------------------------------------------------------------------
if i apply this rotation matrix, it works perfect since i changed glLookAt & angles negated to suit Sensor board coordinate system.

Now, I don't want to change OpenGL upvector in glLookAt , i want to leave it as it is (0,1,0) and want to apply this rotation matrix to object. The object rotation is not intuitive since coordinate system doesn't match.
How can i make the object rotation intuitive without changing glLookAt ?
Someone here tell me how ?
Thanks

1. 1
2. 2
3. 3
4. 4
Rutin
12
5. 5

• 26
• 10
• 9
• 9
• 11
• Forum Statistics

• Total Topics
633694
• Total Posts
3013378
×