当物体由大量三角形时,碰撞检测太消耗性能。
1。以下代码所有的读取模型就会构造KdTree
osgDB::Registry::instance()->setBuildKdTreesHint(osgDB::Options::BUILD_KDTREES);
2。以下代码单独模型构造KdTree
cpp osg::ref_ptr<osgDB::Options> options = new osgDB::Options;
options->setBuildKdTreesHint( osgDB::Options::BUILD_KDTREES );
osg::Node* model = osgDB::readNodeFile( "cow.osg", options.get() );
KdTree用于碰撞优化性能。