If your Node really is a Geode, then the dynamic_cast should succeed and you should get a non-NULL Geode pointer. You say the getDrawable call crashes; to me that sounds like your Geode pointer is NULL but of course you can easily verify that with a debugger. From your code, the only way this could happen is if your Node is not actually a Geode. You might consider using a NodeVisitor and overriding the apply(Geode&) method. If you did this, you would at least be guaranteed that you are dealing with Geodes; detecting the "right" Geode would be up to your code (check the name or some other criteria). Hope that helps, Paul Martz Skew Matrix Software LLC http://www.skew-matrix.com <http://www.skew-matrix.com/> +1 303 859 9466
_____ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jacob Huckaby Sent: Friday, April 11, 2008 11:11 AM To: [email protected] Subject: [osg-users] Node to Drawable? Hi, Quick question (at least I hope it is.) I am trying to find the Drawable inside a Node that I read from a file, to which I can apply a custom TriangleIntersector. I have tried casting the Node as a Geode, and using getDrawable(), but it crashes on the getDrawable(). Here is the code I am trying: osg::Geode* geode = dynamic_cast<osg::Geode*> (node); osg::Drawable* drawable = geode->getDrawable(0); drawable->accept(ti); I have been able to make this work with Shapes that I have put into ShapeDrawables: osg::Box* box = new osg::Box(osg::Vec3(1.0f,1.0f,1.0f),1.0f,1.0f,1.0f); osg::ShapeDrawable* drawable = new osg::ShapeDrawable(box); drawable->accept(ti); My question: how can I get access to the Drawable in my Node (so that I can apply my TriangleIntersector)? It is only a single node. If you have any advice, I would greatly appreciate it. Thank you, Jake
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

