If it's not a Geode, it's probably a Group. Look for the Geode among your Node's
children. This approach may be easier if you always load the same model.

Jacob Huckaby wrote:
> 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
begin:vcard
fn:Per Rosengren
n:Rosengren;Per
org:Royal Institute of Technology (KTH);Computational Vision and Active Perception Laboratory
adr:;;Teknikringen 14, room 621;Stockholm;;11428;Sweden
email;internet:[EMAIL PROTECTED]
title:Ph.D. student
tel;work:+46 8 7906203
note:PGP keyID: 0xD40DD8E0
x-mozilla-html:FALSE
url:http://www.csc.kth.se/~perrose/
version:2.1
end:vcard

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to