Hi everyone, I am working on a little toy flight sim type program using the blue marble data with virtual planet builder, built with --geocentric in wgs84. I have managed to integrate some basic physics, and I set up an eye-point above the vehicle facing down with north always up in my view. I want to have a mode where the view is actually at the eyepoint of the aircraft and matches its rotations. This is where I am having problems...
The data I have are the euler angles and position (xyx). I've tried a number of approachesto manually set the viewmatrix, but so far, I haven't had much luck. I'll outline what i have tried below. At first I tried using a make look at, but I couldn't figure out what the parameters other than eye should be, so I moved on to setting up the matrix myself. First I tried building the rotation matrix by setting it like you would the model matrix, but I realized that it should actually be the inverse of that. I then tried taking the rotation matrix of the aircraft and the translation of the aircraft, and applying them like they do in flightgear, which is : double phi, theta, psi; // given in radians osg::Vec3d position ( x, y, z ); // gcc meters osg::Quat Qeul = makeEulerQuat( phi, theta, psi ); // same function used for drawing the model which works... osg::Matrixd viewMatrix ( osg::Matrixd::translate( -position ) * osg::Matrixd::rotate( Qeul.inverse() ) ); getCamera()->setViewMatrix(viewMatrix); I'm stuck on this one, I haven't been able to get the camera to look correct in any orientation other than top down (because I know how to set up makelookat for that ;)). This must be a fairly common problem, perhaps there is an FAQ or an example I missed that spells it out. Anyone have any idea what I am doing wrong? Thank you!, michael ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=41287#41287 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org