Hello!

I am trying to navigate around my scene using the following code which works 
for pitch and roll (read from a wiimote using the wiiuse library) but when 
forward motion is applied, the camera only travels along one axis, not along 
the vector of it's facing direction. Is there a way of making the camera travel 
in the direction it is looking by a set value?


Code:

osg::Matrixd m = viewer.getCameraManipulator()->getMatrix(), m2;
m2.makeRotate(osg::DegreesToRadians(pitch/100), -1, 0, 0);
m *= m2;
m2.makeRotate(osg::DegreesToRadians(roll/100), 0 , 1, 0);
m *= m2;
osg::Vec3f vec = m2.getRotate().asVec3();
vec.normalize();
m2.makeTranslate(vec);
m *= m2;
viewer.getCameraManipulator()->setByMatrix(m);




Thanks,

illumi

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=53170#53170





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

Reply via email to