[osg-users] osgmanipulator example questions
hesicong2006 at 163.com
Sun Sep 9 23:52:02 PDT 2007
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?
> 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)
> osg::Node* selectedObject=FindByName("Teapot01");
> osgManipulator::Selection* selection = new osgManipulator::Selection;
> osgManipulator::Dragger* dragger = createDragger(name);
> osg::Group* root = new osg::Group;
> float scale = selectedObject->getBound().radius() * 1.6;
> dragger->setMatrix(osg::Matrix::scale(scale, scale, scale) *
> 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.
More information about the osg-users