Are you suggesting that my root would be a group node and under that would
be all the leaf nodes? I don't like that idea because it loses the
hierarchy: streamer is attached to grip, grip is attached to handlebar. If I
delete the grip node, the streamer should go away as well.

Your HandNode example is very similar to what I'm talking about. The
streamer location is relative to the grip. If the grip is moved, the
streamer should maintain is relative position. In my original picture, I
think all the group nodes are actually transform nodes.

It seems like I really do want a Group node with geometry. I guess my
choices are to do something like your HandNode (probably using object
composition rather than inheritance) or pair every Geode with a Group node.

Cory



On Tue, Feb 3, 2009 at 3:46 PM, Paul Martz <pma...@skew-matrix.com> wrote:

>  Use Group nodes. One child is a Geode for the handlebars, the other
> children are the attachments. This doesn't seem clumsy to me, this seems
> clean and straightforward.
>
> If you want to derive your own class from Group that has a built-in Geode
> member variable, this is also an option, and useful in some cases. For
> example, I have a "HandNode" that derives from Transform and displays an
> articulatable hand model. The hand is a scene graph that is owned by the
> HandNode, but not exposed other than via an interface for articulating the
> fingers. Because HandNode is a Transform, you can add children, which are
> then transformed as the hand is transformed (position and orientation in
> space), useful for adding a text label or debugging/visualization aids.
> Traversing both the hand subgraph and the actual children is handled by
> overriding the traverse() method.
>
> However, I'd never do something like this for the general-purpose case you
> describe with the handlebars and attachments; just use off-the-shelf OSG for
> that and save yourself a code maintenance headache.
>
> Paul Martz
> *Skew Matrix Software LLC*
> http://www.skew-matrix.com
> +1 303 859 9466
>
>
>  ------------------------------
> *From:* osg-users-boun...@lists.openscenegraph.org [mailto:
> osg-users-boun...@lists.openscenegraph.org] *On Behalf Of *Cory Riddell
> *Sent:* Tuesday, February 03, 2009 1:09 PM
> *To:* OpenSceneGraph Users
> *Subject:* [osg-users] modelling geodes with children?
>
> I'm looking for advice on typical patterns when modeling something that has
> attachments (which may in turn have other attachments). I first looked for a
> node type that was a composition of Geode and Group but of course I didn't
> find anything.
>
> An example might help here. Say I want to model bicycle handlebars.
> Attached to the handlebar are grips, a light, and a bell. Attached to the
> grips are streamers.
>
> So, the handlebars have geometry and has children (grips, light, and bell).
> The light and bell have geometry, but no children. The grips though, have
> geometry and a child (the streamers). The streamers have geometry only.
>
> How could I model this? I thought about using a group node for any item
> that has both a geometry and children, but that seems clumsy (see the
> attached pic). I have a feeling that there is a simple solution that I'm
> just not seeing here.
>
> Cory
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to