diff --git a/src/osgUtil/IntersectionVisitor.cpp b/src/osgUtil/IntersectionVisitor.cpp index ae95e1c77..c0b61d0b0 100644 --- a/src/osgUtil/IntersectionVisitor.cpp +++ b/src/osgUtil/IntersectionVisitor.cpp @@ -397,6 +397,12 @@ void IntersectionVisitor::apply(osg::Transform& transform) osg::ref_ptr matrix = _modelStack.empty() ? new osg::RefMatrix() : new osg::RefMatrix(*_modelStack.back()); transform.computeLocalToWorldMatrix(*matrix,this); + // We want to ignore the view matrix if the transform is an absolute reference + if (transform.getReferenceFrame() != osg::Transform::RELATIVE_RF) + { + pushViewMatrix(new osg::RefMatrix()); + } + pushModelMatrix(matrix.get()); // now push an new intersector clone transform to the new local coordinates @@ -409,6 +415,11 @@ void IntersectionVisitor::apply(osg::Transform& transform) popModelMatrix(); + if (transform.getReferenceFrame() != osg::Transform::RELATIVE_RF) + { + popViewMatrix(); + } + // tidy up an cached cull variables in the current intersector. leave(); }