|
环境sg3.0
地形文件格式:*.ive
模型文件格式:*.osg
代码如下:- osg::Vec3d start = osg::Vec3d(position.x(), position.y(), position.z() + 20000);
- osg::Vec3d end = osg::Vec3d(position.x(), position.y(), position.z() - 100000);
- osg::ref_ptr<osgUtil::IntersectionVisitor> iv = new osgUtil::IntersectionVisitor;
- osg::ref_ptr<osgUtil::LineSegmentIntersector> line = new osgUtil::LineSegmentIntersector(start, end);
- osgUtil::LineSegmentIntersector::Intersections intersections;
- iv->setIntersector(line.get());
- terrain->accept(*(iv.get()));
- terrain->co
- if(line->containsIntersections())
- {//无法进入
- ...
- }
复制代码 将碰撞检测的线画出来,是和地形有交点的,但是无法进入line->containsIntersections();
大家遇到过这种情况么?怎么解决的? |
|