[osg-users] [osgPlugins] Updating vertices properly + pick only one Geometry object

Jean-Sébastien Guay jean-sebastien.guay at cm-labs.com
Mon Nov 16 08:10:22 PST 2009

Hi Bart,

> The node mask idea also works fine. However, I saw in osgViewer::View a function computeIntersections. The function gave me the impression that it could also fix my problem, without using a node visitor. My idea was to construct an empty NodePath, push the Cloth's node in this NodePath and then pass it to computeIntersections. Unfortunately, it always says there are now intersections. Am I missing something?

computeIntersections uses osgUtil::IntersectionVisitor under the hood, 
so it's just a convenience function. If you're using IntersectionVisitor 
and it's working for you, continue using it that way, you'll have more 

And the reason it doesn't work for you is that you need a complete node 
path from your camera to the model for it to detect intersections 
correctly. Otherwise it uses the coordinates you give (say 300, 400 
which you gave in window space) as object space coordinates... The 
camera is what gives the transformation from window space to world 
space, and then the traversal down from there gives the transformation 
from world space to object space.

So if you wanted to use computeIntersections(), you'd still have to set 
the node masks the way you are now, and use the version of 
computeIntersections that doesn't take a node path.

Hope this helps,

Jean-Sebastien Guay    jean-sebastien.guay at cm-labs.com

More information about the osg-users mailing list