Original Post
Ok - this is gonna be hard to explain so bare with me.
I am creating a 3d space flight sim. I have a pretty good outside camera but it has a problem - it seems to work the same way as ordinary flight simulators' outside cameras work.
When you play an ordinary flight sim and you take off and you fly directly upwards - some flight simulators flip their camera as soon as you start to face toward the airport again - this is caused by the upvector of the camera being 0,1,0 - ie - directly up. Of course - this didnt look too bad - but in space - where there is no up or down - i dont want it to flip when its travelling upwards at 90degrees+.
I tried setting the upvector to the vector perpendicular to the direction of my spaceship - ie its up vector (which can also point down if the space ship is facing toward you.) This didnt work as its different in space - theres no air - so if you thrust toward a planet, turned off engines, your velocity vector is still going toward the planet and then if you turn around your spaceship on the x axis - rotate backwards and forwards - when you are looking straight down the ships up vector, it flips - but when you fly directly up - it doesnt.
Ok - yes this is very confusing - so i will show you the code that i have now - this is the ordinary flight sim code technique.
cameraposition.x = objects[0].Position.x - (objects[0].velvecn.x * 15);
cameraposition.y = objects[0].Position.y - (objects[0].velvecn.y * 15);
cameraposition.z = objects[0].Position.z - (objects[0].velvecn.z * 15);
cameralookat.x = cameraposition.x + objects
cameraup = D3DXVECTOR(0,1,0);
[0].velvec.x;//objects[0].Position.x + objects[0].velvec.x;
cameralookat.y = cameraposition.y + objects[0].velvec.y;//objects[0].Position.y + objects[0].velvec.y;
cameralookat.z = cameraposition.z + objects[0].velvec.z;//objects[0].Position.z + objects[0].velvec.z ;
what i'm looking for is the value to set my upvector - i'll completely understand if you say u havent a clue in hell what i'm talking about - i'm not sure i know myself.
If you prone to headaches - dont try to understand this.
* Edit: Subject - Jim
[edited by - Jim Adams on November 4, 2002 4:09:24 PM]