Can you tell me where it is in the code ? I see in MatrixManipulator::MatrixManipulator() that the view is set as follows:
_homeEye.set(0.0,-1.0,0.0);
_homeCenter.set(0.0,0.0,0.0);
_homeUp.set(0.0,0.0,1.0);
How does that relate to what you are saying ?
-----Original Message-----
From: [EMAIL PROTECTED] on behalf of Paul Martz
Sent: Fri 5/30/2008 10:47 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Representing a trackball view with a cube
OSG's Trackball manipulator (and other core OSG manipulators) set the
modelview matrix so that +Z is up. If you'd like to use +Y up, you'll
need to derive a new manipulator.
BTW, I think this is covered in the online FAQ as well as the Quick
Start Guide.
-Paul
On May 30, 2008, at 8:21 AM, Poirier, Guillaume wrote:
> Hello,
>
> I am trying to represent a trackball view with a cube, with each
> face of the cube labelled "front", "top",
> "right", etc. I'd like the cube to be positioned in the window
> corner and follow the trackball view. I
> assume that the initial home position corresponds to the front view.
> Now I've been playing with this for
> a while and I am getting confused with transformations :(
>
> I create the cube as follows:
>
> m_pFaceFront = osg::createTexturedQuadGeometry(osg::Vec3(-0.5,
> -0.5, -0.5),osg::Vec3(1,0,0),osg::Vec3(0,0,1));
> m_pFaceBack = osg::createTexturedQuadGeometry(osg::Vec3(0.5, 0.5,
> -0.5),osg::Vec3(-1,0,0),osg::Vec3(0,0,1));
> m_pFaceLeft = osg::createTexturedQuadGeometry(osg::Vec3(-0.5, 0.5,
> -0.5),osg::Vec3(0,-1,0),osg::Vec3(0,0,1));
> m_pFaceRight = osg::createTexturedQuadGeometry(osg::Vec3(0.5, -0.5,
> -0.5),osg::Vec3(0,1,0),osg::Vec3(0,0,1));
> m_pFaceTop = osg::createTexturedQuadGeometry(osg::Vec3(-0.5,
> -0.5, 0.5),osg::Vec3(1,0,0),osg::Vec3(0,1,0));
> m_pFaceBottom = osg::createTexturedQuadGeometry(osg::Vec3(-0.5, 0.5,
> -0.5),osg::Vec3(1,0,0),osg::Vec3(0,-1,0));
>
> So I believe that the "front" is facing -Y, "top" +Z, and "right" +X.
>
> I place the cube under a camera with absolute reference frame and
> set the view to identity. I am thinking the
> view frame has +X to the right, +Y up, and +Z out of the screen.
> What I see is the bottom face upside down.
> I would have expected to see the top face so I am not entirely sure
> what is going on...
>
> My second question is how to make the cube follow the trackball
> view. The cube has a matrix transform as a parent
> and I set its rotation in an update callback as follows:
>
> osg::Matrixd invMat;
> invMat = m_pViewCube->GetView()->getCameraManipulator()-
> >getInverseMatrix();
> osg::Matrixd rotMat;
> rotMat.setRotate(invMat.getRotate());
> m_pViewCube->GetTransform()->setMatrix(rotMat);
>
> The cube rotation is "inverted" wrt to the trackball when using the
> inverse matrix. Using the manipulator matrix
> instead of its inverse, the cube follows correctly on drag
> vertically but has the wrong rotation axis on drag horizontally...
>
> Any help with this would be greatly appreciated !
>
>
> bill
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
<<winmail.dat>>
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

