[osg-users] Avoiding the intersection visitor

Viggo Løvli vigigio at hotmail.com
Mon Jul 21 01:37:03 PDT 2008


Hi,
 
I want to save some CPU-cycles by ignoring collision-detection on some of my scene nodes.
Is the following code the best way to do it?
 
void MyGroup::traverse( osg::NodeVisitor& nv)
{
    switch( nv.getVisitorType() )
    {
    case osg::NodeVisitor::NODE_VISITOR:
        if( dynamic_cast<osgUtil::IntersectionVisitor*>(&nv) )
        {
            return;  // Prohibit visitor from visiting my children
        }
 
    ... other traverse code ...
 
    }
    osg::Group::traverse( nv );
}
 
The class MyGroup (public of osg::Group) is the parent of all nodes that I do not want intersection visitors to see.
 
Viggo
 
_________________________________________________________________
Hold kontakten med Windows Live Messenger.
http://clk.atdmt.com/GBL/go/msnnkdre0010000003gbl/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080721/44394555/attachment-0002.htm>


More information about the osg-users mailing list