[osg-users] Drawing the bounding sphere of a camera

Aaron Andersen aaron at fosslib.net
Sat Aug 29 11:43:22 PDT 2015


Hello,

I've attached a bounding sphere to the camera in my scene but the 
bounding sphere never moves, even when I move the camera. Can anyone 
explain to me what I'm doing wrong here?

code:

osg::ref_ptr<osg::Geode> cameraDebugSphere = new osg::Geode;
osg::ref_ptr<osg::ShapeDrawable> drawable = new osg::ShapeDrawable;

drawable->setShape(new osg::Sphere(osg::Vec3(0, 0, 0), 60));
drawable->setColor(osg::Vec4(1.0f, 0.0f, 0.0f, 0.2f));

cameraDebugSphere->addDrawable(drawable.get());
viewer.getCamera()->addChild(cameraDebugSphere.get());

Shouldn't this draw a sphere that surrounds the camera?

Thank you for any input.
Aaron



More information about the osg-users mailing list