View Full Version : Flight Simulator Example?
04-04-2005, 03:29 PM
Hi, I'm working on a flight sim game with 6 degrees of freedom but I'm having absolutely no luck with the ship movement rotation. It's rotating about the world origin rather than the local origin. Does anyone have some sample code on how to do this? I'd be extremely greatful. This is my attempt so far..
thanks a lot in advance! =)
04-04-2005, 04:36 PM
Move your rotation of the ship to the other side of your ship translation.
04-05-2005, 03:52 AM
Thanks for the advice dorbie but I've tried that already. It rotates around the local axis then, but it carries on moving along the world axix. In other words, its direction in which it points has no effect on the direction which it moves in. =(
04-05-2005, 10:55 AM
Is it just me or is there no open else using openGL for games? I can't find any game-related openGL tuts grr. maybe I should have stuck to DirectX =(
04-05-2005, 08:02 PM
Have you ever played Quake3?
04-06-2005, 02:22 AM
Yeah I have, great game, but I just mean there's not much in terms of tutorials for openGL game programming. It all seems to be about graphics applications =(
04-06-2005, 10:49 AM
Theres several books out there that are about gaming using OpengGL,
And i have come across quite a few Opengl based games on the net, I dont have the links with me, but a google search or http://sourceforge.net should pop some up
04-06-2005, 02:46 PM
Thanks urban, I'll have a look
I had the same problem while trying to move my camera around and then strafe/move in the correct direction.
I solved it by creating two 3d-vectors, currentLook and currentPosition.
By implementing them as below I then made the camera function properly in all directions.
The cross product of the currentLook vector and the normal, Y-axis in my case, will then be the "strafe vector" of the camera.
Im not sure how this will work when you can rotate around the z-axis aswell, but if you can get your plane-normal right it shouldnt be a problem.
void CCamera::MoveCamera(int KeyCase)
m_curPos -= m_curLook*0.05;
case 4: crossP=m_curLook.CrossProduct(VECTOR3D(0,1,0));
case 6: crossP=m_curLook.CrossProduct(VECTOR3D(0,1,0));
m_curPos += m_curLook*0.05;
04-08-2005, 02:30 AM
Thanks, I'll give it a go. I've managed to get movement int the x-z plane pretty much sorted now but I'd be open to new ideas. Thanks a lot =)
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.