Hi!

I would like to show angles of rotation but i get some problems :

[...]
objMat = matrixTransform->getMatrix();
osg::Vec3 rot;
     rot[0] = v3->z-hpr.z(); // value taken from widget and difference
between old and new value;
     rot[1] = v3->x-hpr.x();
     rot[2] = v3->y-hpr.y();

    osg::Matrix H;
    H.makeRotate(osg::DegreesToRadians(rot[0]), osg::Vec3(0,0,1)); //
attitude
    osg::Matrix P;
    P.makeRotate(osg::DegreesToRadians(rot[1]), osg::Vec3(1,0,0)); // pitch
    osg::Matrix R;
    R.makeRotate(osg::DegreesToRadians(rot[2]), osg::Vec3(0,1,0)); // roll
    rotMat = H*P*R;

    matrixTransform->setMatrix(rotMat*objMat);
[..]

For example i write 45 degrees for pitch and my box rotates nice and next i
use osgMatrixToHpr(hpr, mat) to convert from matrix and get x = 45 y = 0 z =
0 so it's good.
Later i wrote 45 for roll and my box transforms (pitch = 45, roll = 45 ,
attitude =0)  but i get values like that : x = 54.73560 , y = 30 , z
=35.264389 and i wanted smth like this x= 45, y=45, z =0

What should i do to show them properly or transform properly ?

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

Reply via email to