Ok, thanks Robert.
Actually I found a simple way to do it myself. Here it is :
-Build a matrix from the plane PAT's attitude :
osg::Matrixd planeMat(plane->getPAT()->getAttitude());
-Inject the plane PAT's position vector into this matrix :
osg::Vec3d planePos(plane->getPAT()->getPosition());
planeMat(3,0)=planePos[0];
planeMat(3,1)=planePos[1];
planeMat(3,2)=planePos[2];
-Build another matrix from my virtual optical sensor PAT (identity for attitude) :
osg::Matrixd camMat;
camMat.makeIdentity();
osg::Vec3d camPos(sensor->getPat()->getPosition());
camMat(3,0)=camPos[0];
camMat(3,1)=camPos[1];
camMat(3,2)=camPos[2];
-Then just multiply the matrixes, and retrieve the position :
osg::Matrixd absolutePosMatrix = planeMat * camMat;
osg::Vec3d absoluteCamPosition(absolutePosMatrix(3,0), absolutePosMatrix(3,1), absolutePosMatrix(3,2));
It was simple maths indeed,
David
_______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
