Hello friends,
I have a problem with camera view, I have a object that change their
coordinates all the time and I want that the camera shows the object's first
person view. My code is :
Code:
osgGA::TrackballManipulator *trackballManipulator = new
osgGA::TrackballManipulator();
viewer.setCameraManipulator(trackballManipulator);
trackballManipulator->setByMatrix(setCameraPosition(Buf.ObjPosX,
Buf.ObjPosY,Buf.ObjPosZ,Buf.ObsPosH,Buf.ObsPosP,Buf.ObsPosR));
where setCameraPosition is
Code:
osg::Matrixd setCameraPosition(double posX , double posY , double posZ ,
double rotH , double rotP , double rotR){
osg::Matrixd myCameraMatrix;
osg::Matrixd cameraRotation;
osg::Matrixd cameraTrans;
cameraRotation.makeRotate(
osg::DegreesToRadians(rotR), osg::Vec3(0,1,0), // roll
osg::DegreesToRadians(rotP), osg::Vec3(1,0,0) , // pitch
osg::DegreesToRadians(rotH), osg::Vec3(0,0,1) ); // heading
cameraTrans.makeTranslate( posX, posY, posZ);
myCameraMatrix = cameraRotation * cameraTrans;
return myCameraMatrix;
}
my problem is that when I use
Code:
trackballManipulator->setByMatrix(setCameraPosition(Buf.ObjPosX,
Buf.ObjPosY,Buf.ObjPosZ,Buf.ObsPosH,Buf.ObsPosP,Buf.ObsPosR));
the view axis Z is now X, the view axis X is Y and Y is now Z, any idea for
solve my problem?
Thank you!
manue
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=25979#25979
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org