Hi Everyone,

I'm new to using OSG so please forgive me if some of my terms or ideas are 
incorrect. My overall goal currently is to simply rotate the camera(x-axis, 
y-axis, and/or z-axis), based on the users mouse position(i.e. when the user 
moves the mouse in any direction, camera rotates - rather than click and drag). 
For now, I've just been trying to rotate(or even translate) the camera(in any 
way) of the BasicGeometry.cpp program just so I can start to get the idea. What 
I have so far:

.
.
.
//viewer defined as osgViewer::Viewer viewer;
viewer.setCameraManipulator(new osgGA::TrackballManipulator());
viewer.realize();
while( !viewer.done() )
{
     osg::Matrixd cameraRotation;
     osg::Matrixd cameraTrans;
     cameraRotation.makeRotate(osg::DegreesToRadians(-20.0),       
osg::Vec3(0,1,0), // roll
     osg::DegreesToRadians(-15.0), osg::Vec3(1,0,0) , // pitch
     osg::DegreesToRadians( 10.0), osg::Vec3(0,0,1) ); // heading 
     cameraTrans.makeTranslate( 10,-50,15 );
     viewer.getCamera()->setViewMatrix(cameraTrans * cameraRotation);
     viewer.frame();
}
                

My thinking is that by setting up a rotation matrix and a translation matrix, 
the product of these matrices would provided by the desired position. Then, 
with this we can set the viewer's camera to this desired matrix.

The code compiles and runs, but this doesn't operate as planned. Could someone 
explain why this process doesn't work and how I should approach this issue?

Any help is much appreciated.
Thank you!

Cheers,
Drew

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=56531#56531





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to