Hi Jamie,

To use a wii remote with the OSG I'd either write a custom
CameraManipulator to do this integration and provide the appropriate
view matrix (via the getInverseMatrix() method) or just directly set
the viewer's Camera's ViewMatrix directly and not use a
CameraManipulator at all.  Either of these route would avoid the
potential pitfall of your code modifying the CameraManipulator's
matrix only for this to be over written by CameraManpulator's own
update methods.

For the direction issue, this is likely an issue with either ordering
of the transform you are setting up or the coordinate frame.  I know
nothing of the specific wii coordinate frame so can't comment
specifically on this.

Robert.

On 20 March 2013 11:17, Jamie Spence <[email protected]> wrote:
> 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
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to