|
objectBB = osgFunc2_4::ComputeBoundsBox(objectPAT.get());
osg::Vec3 newPos = objectBB.center()-osg::Vec3(0.0,0.0,0.5);
osgUtil::IntersectVisitor ivXY;
osg::ref_ptr<osg:ineSegment> line = new osg::LineSegment(newPos,objectBB.center());
ivXY.addLineSegment(line.get());
mViewer->getSceneData()->accept(ivXY);
if (ivXY.hits())
{
AfxMessageBox("true");
return true;
}
做一个最简单的碰撞检测,从一个物体的包围盒中心向下发出一条射线,如果有交集,则弹出一个框框,是这样写吗???求教。。。 |
|