2009/5/22 Paul Griffiths <gaffe...@gmail.com>: > Ive came up with this but it returns outside true every time regardless: > > > Code: > > bool outside = false; > if (obj->getParentWidget() && > obj->getParentWidget()->getUsingClipBoundingBox()) > { > osg::ref_ptr<osg::ClipNode> clipNode = > obj->getParentWidget()->getClipNode(); > if (clipNode) > { > for (unsigned int i = 0; i < clipNode->getNumClipPlanes(); i++) > { > osg::ref_ptr<osg::ClipPlane> plane = clipNode->getClipPlane(i); > osg::Vec4d pl = plane->getClipPlane(); > osg::Vec3d pt = hitr->getWorldIntersectPoint(); > if (( pt.x() * pl.x() + pt.y() * pl.y() + pt.z() * pl.z() + pl.w() > ) < 0.f) > { > outside = true; > break; > } > } > } > } > > > > > i set the clip node like: > > Code: > > this->clipBoundingBox.set(pos.x() - this->size.x(),pos.y() - > this->size.y(),pos.z() - this->size.z(),pos.x() + this->size.x(), pos.y() + > this->size.y(), pos.z() + this->size.z()); > this->clipNode->createClipBox(this->clipBoundingBox); > this->panel.setStateSet(this->clipNode->getStateSet());
Okies, if memory serves me correctly, the clip planes aren't in world coordinates, I think they are in eye coordinates. So that would be take the local intersection coordinate and transform it using computeLocalToEye (in osg/Transform) and test that point. If that doesn't work, you'll need to post another question for how to do that. -- http://www.ssTk.co.uk _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org