Unfortunalety there is no feature "throw" feature. My class inherits from 
osgGA::GUIEventHandler and there is no setAllowThrow implemented, as far as I 
know.

Here is (part of) my actual mouse dragging code:


Code:


bool CameraHandler::handle(const osgGA::GUIEventAdapter & ea, 
osgGA::GUIActionAdapter & us)
{
                osgViewer::View* viewer = dynamic_cast<osgViewer::View*>(&us);
                osg::Matrixd viewMatrix = viewer->getCamera()->getViewMatrix();
                osg::Vec3d translation = viewMatrix.getTrans();

                osg::Matrixd rotationX = osg::Matrix::rotate(deltaX  * 0.5, 
osg::Y_AXIS);
                osg::Matrixd rotationY = osg::Matrix::rotate(-deltaY * 0.5, 
osg::X_AXIS);
                osg::Matrixd preTrans = osg::Matrix::identity();
                osg::Matrixd postTrans = osg::Matrix::identity();

                osg::Vec3d bsCenter = osg::Vec3d(137.69, 284.17, 3305.0); // 
scene is (almost) static
                m_rotationPoint = osg::Vec3(0.0, 0.0 , 0.0); // good rotation 
point for 
                
                m_rotationPoint = translation - bsCenter; // good rotation 
point for 

                preTrans.setTrans(-m_rotationPoint);
                postTrans.setTrans(m_rotationPoint);
                
                viewMatrix = viewMatrix * (preTrans * rotationX * rotationY * 
postTrans);
                viewer->getCamera()->setViewMatrix(viewMatrix);
                
                // ensure fixed point to look at
                osg::Vec3d eye, center, up;
                viewer->getCamera()->getViewMatrixAsLookAt(eye, center, up);
                if (focusPointFlag)
                {
                    viewer->getCamera()->setViewMatrixAsLookAt(eye, bsCenter , 
up);
                }

                return true;
}





And if I am zooming in, sometimes the effect gets worse and the camera is 
hardly to control. Maybe there is an error in my rotation setup?

Thank you!

Cheers
Daniel Neos


cbuchner1 wrote:
> Could it be that the "throw" feature of the camera manipulator is responsible 
> for the roll?
> 
> If so, try disabling it.
> 
> 
> Also, post source code if you want specific help with a specific issue in 
> your implementation.
> 
> 
> Christian
> 
> 
> 
> 



Code:




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





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

Reply via email to