[osg-users] osgmanipulator example questions

David Callu ledocc at gmail.com
Mon Sep 10 02:30:58 PDT 2007


Hi,


Can you send the osgmanipulator.cpp modified and your scene to test?

David Callu

2007/9/10, hesicong2006 <hesicong2006 at 163.com>:
>
> I know why. root should add an Child include the scene.
>
> But another question. I can drag the Teapot01, but the whole scene now
> has two "Teapot". Then how can I fix it?
>
> hesicong2006 wrote:
> > Hi, Robert
> > Someday before I asked a question about drag object in OSG and you told
> > me to see osgmanipulator example. It's great.
> > I tried to modify it as I want to move one object in the scene but the
> > whole scene. I tried to do this in addDraggerToScene function:
> >
> > osg::Node* addDraggerToScene(osg::Node* scene,
> > osgManipulator::CommandManager* cmdMgr, const std::string& name)
> > {
> >    scene->getOrCreateStateSet()->setMode(GL_NORMALIZE,
> > osg::StateAttribute::ON);
> >
> >    osg::Node* selectedObject=FindByName("Teapot01");
> >
> >    osgManipulator::Selection* selection = new osgManipulator::Selection;
> >    selection->addChild(selectedObject);
> >
> >    osgManipulator::Dragger* dragger = createDragger(name);
> >
> >    osg::Group* root = new osg::Group;
> >    root->addChild(dragger);
> >    root->addChild(selection);
> >    root->addChild(createHUD());
> >
> >    float scale = selectedObject->getBound().radius() * 1.6;
> >    dragger->setMatrix(osg::Matrix::scale(scale, scale, scale) *
> >
> > osg::Matrix::translate(selectedObject->getBound().center()));
> >    cmdMgr->connect(*dragger, *selection);
> >
> >    return root;
> > }
> >
> >
> > And here my scene has two objects, one teapot, one box. But when I run
> > the program, I see only the "Teapot01" which really can drag and move,
> > but the box is lost!
> > I don't know how to only move one object in the scene. Please give me
> > some ideas. Thanks.
> >
> >
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20070910/1bf0ef6d/attachment-0003.htm>


More information about the osg-users mailing list