Hi Paul,

    const osg::MatrixList& m = node->getWorldMatrices();
    osg::ComputeBoundsVisitor cbv;
    node->accept( cbv );
    osg::BoundingBox bb = cbv.getBoundingBox();
    osg::Vec3 minV = bb._min * m.front();
    osg::Vec3 maxV = bb._max * m.front();
    osg::notify( osg::ALWAYS ) << minV << std::endl << maxV << std::endl;

This method does not result in an AABB if the matrix contained a rotation. The bounding box is no longer axis-aligned.

You need to do as the OP suggested, transform the 8 corners of the box and then rebuild an AABB from those. Though I think the code could be simplified and cleaned up.

J-S
--
______________________________________________________
Jean-Sebastien Guay    [email protected]
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to