HRESULT CALLBACK EmaginZ800Class::TrackProc(EMADeviceData* data, void* param)
{
    if ( NULL == data )
    {
        return EMA_INVALID_PARAMETER;
    }
  
    // make a copy of the command so we can use it later on
    // when we draw the data on the screen
    Yaw = data->Yaw;
    Pitch = data->Pitch;
    Roll = data->Roll;

    //std::cout << Yaw << " " << Pitch << " " << Roll << std::endl;

    return S_OK;
}

....my example

        osg::Matrixd myCameraMatrix;
        osg::Matrixd cameraRotation;
        osg::Matrixd cameraTrans;

        float xtrans = BodyX;
        float ztrans = BodyY;
        float ytrans = BodyZ;
        float xrotate  = 360.0f - HeadX;
        float yrotate  = HeadY;//UserInput->getYrotate();
        float zrotate  = HeadZ;

        cameraRotation.makeRotate(
        osg::DegreesToRadians(zrotate), osg::Vec3(0,1,0), // roll
        osg::DegreesToRadians(yrotate), osg::Vec3(1,0,0) , // pitch
        osg::DegreesToRadians(xrotate), osg::Vec3(0,0,1) ); // heading

        cameraTrans.makeTranslate( xtrans,ztrans,ytrans );
        myCameraMatrix = cameraRotation * cameraTrans;

        osg::Matrixd i = myCameraMatrix.inverse(myCameraMatrix);
        .....getViewer()->getCamera()->setViewMatrix((osg::Matrixd(i.ptr()))* osg::Matrixd::rotate( -3.14f / 2.0, 1, 0, 0 ));






13.09.08, 14:08, "alessandro terenzi" <[EMAIL PROTECTED]>:
I'm going to use a head-mounted display with integrated head tracker in my osg application. The tracker sensors, when activated, actually replace the mouse, so for instance is possible to move the cursor on the desktop just moving the head. I wonder how to use it inside an osg application, in particular I thought to modify one of the provided manipulators but, since I still don't know how manipulators work internally, I'd like to ask an advice about how to proceed or where to start.
 
Looking at examples, it looks like that the DriverManipulator could be very useful for my goal, because it already lets me move the head to the left and to the right but I cannot just move the head up and down, so I think it would be a good idea to start from that manipulator.
 
Is still a better way to do it?
 
Anyway, if I have to implement a new manipulator, what should I know about them? How do manipulators work in general?
 
Thank you.
Alessandro


--
Жизнь без спама на Яндекс.Почте http://mail.yandex.ru/nospam
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to