Diana, First off, I don't see where you're setting the view matrix for the camera in your code below. You compute the transform, but you'll need to attach it to the camera.
Since it looks like you're navigating on a sphere, I would try the following in your "while" loop below... osg::EllipsoidModel convert; osg::Matrixd position; osg::Matrixd t_matrix; convert.computeLocalToWorldTransformFromLatLongHeight(lat,lon,height,pos ition); t_matrix = position; t_matrix.invert(t_matrix); osg::Matrixd rotate2YUp; rotate2YUp.makeRotate(-M_PI_2, osg::Vec3f(1.0, 0.0, 0.0)); t_matrix *= rotate2YUp; viewer.getCamera()->setViewMatrix(t_matrix); viewer.frame(); Of course, I'm assuming that you have all the other camera state (i.e. projection matrix, viewport, etc.) set up correctly. The above doesn't include an orientation transform so you will need to add that. When you do, it will be concatenated with the position matrix. Make sure that lat, lon are in RADIANS when you call computeLocalToWorldTransformFromLatLongHeight. Height is usually in meters. One more thing...it would probably be best to move the code outside of the "while" loop and place it in an UpdateCallback... -Shayne -----Original Message----- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Diana Kittelmann Sent: Wednesday, June 08, 2011 2:59 AM To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] Setting up a camera Yeah, I'm just seeing the blue background. And yaeh im struggeling with the math to set up my matrix. I set it up like this: while(!viewer.done()) { osg::EllipsoidModel convert; convert.convertLatLonHeightToXYZ(lat, lon, height, x, y, z); osg::Vec3 pos(x, y, z); osg::Matrixd matrix; matrix.setRotate(osg::Quat(osg::DegreesToRadians(0.0), osg::X_AXIS, osg::DegreesToRadians(0.0), osg::Y_AXIS, osg::DegreesToRadians(0.0), osg::Z_AXIS)); matrix.setTrans(pos); viewer.getCamera(); viewer.frame(); } But I'm not sure if this is right. Diana ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=40200#40200 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or g _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org