|
void apply( osg::Geode& geode )
{
for ( unsigned int i = 0; i < geode.getNumDrawables(); ++i )
{
osg:rawable* drawable = geode.getDrawable(i);
if ( !drawable) continue;
osg::Box* box = dynamic_cast<osg::Box*>(drawable->getShape());
if ( box )
{
osg::Vec3 center = box->getCenter();
std::cout << "center: " << center.x() << " " << center.y() << " " << center.z() << std::endl;
osg::Vec3 size = box->getHalfLengths();
std::cout << "size: " << size.x() << " " << size.y() << " " << size.z() << std::endl;
}
}
}
得到的center始终为osg::vec3(0, 0, 0),请问如何得到该box的世界坐标? |
|