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! =)
Move your rotation of the ship to the other side of your ship translation.
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. =(
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 =(
Have you ever played Quake3?
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 =(
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
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_curLook0.05;
case 4: crossP=m_curLook.CrossProduct(VECTOR3D(0,1,0));
case 6: crossP=m_curLook.CrossProduct(VECTOR3D(0,1,0));
m_curPos += m_curLook0.05;
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 =)