[osg-users] Camera Manipulator problem
Greetings all, I'm using the CameraManipulator from the NPS 11.x tutorial to follow a MatrixTransform object. The MatrixTransform position/orientation per usual with an Node UpdateCallback. The manipulator simply attaches a node to the MatrixTransform node with a callback which grabs the parent NodePath (of the MatrixTransform node), represented in WOrld coordinates; i.e., per the demo code:. struct updateAccumulatedMatrix : public osg::NodeCallback { virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) { matrix = osg::computeWorldToLocal(nv->getNodePath() ); traverse(node,nv); } osg::Matrix matrix; }; What happens is that the camera appears to occasionally be updated with the previous frame's parent object position/orientation. The affect is that it will 'jitter' say, every 10 frames or something like that... I tried to setDataVariance(osg::Object::Dynamic) for both the MatrixTransform and the node and still the same problem. But, when I attach a built in CameraManipulator to the viewer I don't have the problem. It is as if the node with the Callback is being called sometimes before, or sometimes after, the MatrixTransform parent object's callback. Possible? What might I be missing? Is there a way to control when the CameraManipulator is updating the view matrix? the app is running under WinXP 32b through wxWIndows/Visual Studio9, if that matters. thanks very much for any insights, suggestions, help-- t ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Camera Manipulator problem
Hello. I try to make my own camera manipulator in which the push events with X lower than the half of the window will be ignored. I created a class, which derives trackball manipulator. Here is the handle method virtual bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us ) { if (ea.getEventType() == osgGA::GUIEventAdapter::PUSH && isInBounds(ea.getX(), ea.getY())) { return true; } return osgGA::TrackballManipulator::handle(ea, us); } Even though I return true (which means i dont want further handle), it keeps taking into account the event. Is there anything wrong with the code above ? thnx. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Camera Manipulator problem
Hi Peterakos, There isn't any way a third party will be able to diagnose the problem with your code with such a tiny extract of code. The best I can suggest is develop your own skills of hunting down and fixing bugs. Using a debug to see the flow of control, or add debug message that output results to the console so you can learn about what is happening. With looking things more closely the problem in your code should jump out. Robert. On 19 February 2013 01:32, Peterakos wrote: > Hello. > > I try to make my own camera manipulator in which the push events with > X lower than the half of the window will be ignored. > > I created a class, which derives trackball manipulator. > Here is the handle method > > virtual bool handle( const osgGA::GUIEventAdapter& ea, > osgGA::GUIActionAdapter& us ) { > if (ea.getEventType() == osgGA::GUIEventAdapter::PUSH && > isInBounds(ea.getX(), ea.getY())) { > return true; > } > return osgGA::TrackballManipulator::handle(ea, us); > } > > Even though I return true (which means i dont want further handle), it > keeps taking into account the event. > > Is there anything wrong with the code above ? > > thnx. > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org