Hi, I've been experimenting with two ways of setting up a simple node. Sorry for the long post. I've tried to provide enough info so it isn't a "why does this one line of code work" type post.
The root of the nodes in question is setup (in both cases) like this: Code: osg::Group *group = new osg::Group(); dragger->setupDefaultGeometry(); dragger->addTransformUpdating(selection); group->addChild(dragger); group->addChild(selection); selection->addChild(geode.get()); root = group; "selection" is a MatrixTransform, and geode is a quad. If I scale the dragger independently of the selection, then picking of the dragger works. If I copy the selection matrix to the dragger, the dragger shows but picking never "sees" it. 1) Setup the dragger matrix and selection matrix independently: Code: // Create the transform that'll move the object selection = new osg::MatrixTransform; osg::Matrix tM(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); selection->setMatrix(tM); //... and then setting the dragger ... // Put the dragger over the rectangular object osg::Matrix matrix = selection->getMatrix(); matrix.postMultScale(osg::Vec3f(originalWidth, 1, originalHeight)); dragger->setMatrix(matrix); vs, 2) Setup the dragger matrix using the selection matrix: Code: // Create the transform that'll move the object selection = new osg::MatrixTransform; osg::Matrix tM(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); tM.postMultScale(osg::Vec3(originalWidth, 0, originalHeight)); selection->setMatrix(tM); //... and then setting the dragger ... // Put the dragger over the rectangular object osg::Matrix matrix = selection->getMatrix(); dragger->setMatrix(matrix); The difference with (2) is that the selection is being used to scale the geode, with the line: Code: tM.postMultScale(osg::Vec3(originalWidth, 0, originalHeight)); And that the dragger is setup by simply copying the selection matrix. Where originalWidth and originalHeight are valid values (the size of a picture being drawn into a quad). However if I use this later method, the LineSegmentIntersector doesn't pick up the Dragger when clicked. It's drawn OK. You can see it. It's as if the intersection test isn't taking into account the scaling. Am I not using OSG correctly, by putting the size scaler into the parent transform of the geode? ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=21469#21469 _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

