Flt Sim Local coordinates => Global coordinates?

Started by
1 comment, last by TolTol 21 years, 2 months ago
Hi all, I''m creating a flight simulator for college, I have 4 vectors representing the forces that act on the aeroplane (lift, thrust, drag & weight) which are referenced from the origin and 1 vector representing the aeroplane''s position. I''m using the OpenGL function "gluLookAt(vPos, vLook, vUp)" to set up the camera. My question is this..How do I transfer the local coordinate vectors lift and thrust to global coordinates so that I can use them in gluLookAt()? I''m putting the position vector as the first parameter, the thrust vector as the look parameter, and the lift vector as the up parameter. I''m currently adding the position vector to the up vector to transfer it to global coordinates but its giving me strange results. Any help or suggests would be muchly appreciated as I''m stuck at this problem for quite a while. Thanks.
Advertisement
I might not be understanding you correctly but, can't you just make your variables global? or do you have to send them over parameters?

eg:
//********************************

// any includes

#define WIN32_LEAN_AND_MEAN

float vpos; // New Global Variable

void main()
{
// float vpos; <---old variable

}

// Note: i know this isn't OpenGL or Windows API, just an example.

[edited by - JYoung on February 8, 2003 1:52:27 PM]
Hum, I''m a bit confused, but I''ll give it a try. Try the position vector plus the thrust vector for the second parameter. You are at the first parameter looking at the second parameter with up in the direction of the third parameter. As near as I can tell you are more or less looking back at the worlds origin. Actually a displacement of the thrust vector from the world''s origin. gluLookAt is mainly to save you a bit of effort. I believe you could just put yourself into object space and use values relative to the plane''s origin. Your thrust is most likely straight down one axis and your up straight along another.
Keys to success: Ability, ambition and opportunity.

This topic is closed to new replies.

Advertisement