Hi, I am having some extreme difficulty in rotating my viewing camera 90 degrees with respect to a "local" coordinate system.
Local coordinate system: (in geocentric measure) mine is at the edge of the earth; i.e. i'm using a spherical earth. here is how I compute the local axes: fuctionName ( osg::PositionAttitudeTransform pax ) { osg::vec3d objectLocation = pax->getPosition(); // where x,y,z are -678468.2, -5405095.0, 3682910.3 osg:;quat qOrient = pax->getAttitude(); osg::vec3d up(0,0,1); // z axis of the earth or World coordinates osg::vec3d x_axis = up ^ objectLocaction; osg::vec3d y_axis = objectLocaction ^ x_axis; x_axis.normalize(); y_axis.normalize(); osg::Quat qRotAboutAxisByDegree; qRotAboutAxisByDegree.makeRotate( osg::DegreesToRadians(-90.), objectLocaction); osg::Quat qNewOrient = qOrient * qRotAboutAxisByDegree; s_mtxdIrCamPosOrientOri = osg::matrix::rotate(qNewOrient) * osg::matrix::translate(objectLocation); } 1. I know for a fact that the pax is set correctly with position & attitude because my objects are being placed on my terrain, which is georeferenced terrain, correctly; i.e. they are perpendicular w/ the terrain and sit nicely on it. 2. the above code snippet actually works for rotation about the "local" Z axis and I am looking straight down at my terrain; i.e. directly down the local Z axis. 3. I want to rotate the camera "up" 90 degrees and be looking down the positive X axis. 4. I have tried replacing qRotAboutAxisByDegree.makeRotate( osg::DegreesToRadians(-90.), objectLocaction); with qRotAboutAxisByDegree.makeRotate( osg::DegreesToRadians(-90.), x_axis); and I get the camera rotated about some axis I am NOT sure of and I am looking at the terrain from a peculiar angle, though I know not what angle. 5. I am using the TerrainManipulator as my scene matrix manipulator, if that helps. Would someone please give me insight as to how to do this? I would be greatly appreciative as the solution is totally eluding me. :O ... Thank you! Thank you very much. Cheers, Allen ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=25471#25471 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org