Hi all,

I am working on a program which display a little map of a particular
place.

I know the question has been already asked but I really don't
understand how to proceed.

I would like use 3d space navigator which is mapped like a simple
joystick
(with RBC9-SpaceNav driver),

values' access from axes can do with variables : etat.lX, etat.lY,
etat.lZ for translation and
etat.lRx, etat.lRy, etat.lRz for rotation which give a value between 0
and 360.

I use directinput to enable joystick too.

so, here's the problem, i want control main camera (as an helicopter)

movements of this camera moves the point of view and not the map.

I saw I don't declare a trackball/flight/..manipulator but

on the main loop  I must do something like that :

DIJOYSTATE2 etat;
Matrixd, myViewMatrix, camRot, camTrans;

viewer.realize();

while(!viewer.done())
{
  //Recover joystick's state
  joystick->etatsJoystick(&etat);

  camRot.makeRotate(degreesToRadians(etat.lRx),Vec3(1,0,0),
                    degreesToRadians(etat.lRy),Vec3(0,0,1),
                    degreesToRadians(etat.lRz),Vec3(0,1,0)
                   );
  camTrans.makeTranslate(etat.lX,etat.lZ,etat.lY);
  myViewMatrix = camRot*camTrans;
  viewer.getCamera()->setViewMatrix(myViewMatrix);
  viewer.frame();
}


1) my map is not centered like when i use trackball/Flight/
terrain...Manipulator
   so how to do to center my object in the middle of the screen ?
   I initialize object with positionAttitudetransform with a 60°deg
rotation of x-axis.

2) How to keep the last position when I release 3d mouse ?
   at this time, when I release, object takes his initial position.

these questions comes from missunderstanding of osg and algorithmic/
logic problems.


thanks for reading.. and answering.
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to