Could you not check the name of parent node to identify the instance of the 
child?
 
I might be wrong I haven't used the picking functionality for a while.
 
K.

________________________________

From: [email protected] on behalf of Paul Griffiths
Sent: Sat 23/05/2009 15:39
To: [email protected]
Subject: Re: [osg-users] Referencing loaded models




Kim C Bale wrote:
> Hi Sebastian,
>
> Unless you explicitly ask the osg to clone your model's geometry it will 
> share the geometry by default. It simply stores a pointer to the loaded 
> model's vertices etc. So the below code should work for you.
>
> You can also set osgDB to cache the model in memory so that if you ever call 
> osgDB::load() with the same path and filename it will just return a pointer 
> to the cached model rather than reloading it.
>
> osg::Group* rootNode = new osg::Group;
>
> osg::Node* loadedModel = osgDB::load(....);
>
> osg::PositudeAttitudeTransfrom* instance_1 = new 
> osg::PositudeAttitudeTransfrom
> instance_1->setPosition( 10.f, 0.0, 0.0);
> instance_1->addChild(loadedModel);
>
> osg::PositudeAttitudeTransfrom* instance_2 = new 
> osg::PositudeAttitudeTransfrom
> instance_2->setPosition( 20.f, 0.0, 0.0);
> instance_2->addChild(loadedModel);
>
> osg::PositudeAttitudeTransfrom* instance_3 = new 
> osg::PositudeAttitudeTransfrom
> instance_3->setPosition( 30.f, 0.0, 0.0);
> instance_3->addChild(loadedModel);
>
> //now attach the instances to the graph
> rootNode->addChild(instance_1);
> rootNode->addChild(instance_2);
> rootNode->addChild(instance_3);
>
> viewer.setSceneData(rootNode);
>
> Regards,
>
> Kim.


That works fine unless your pickick with the mouse. Is you select any of the 
nodes it always selects the first node :(

So i had to make a clone for each instance.

Guess it depense if your picking...

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=12815#12815





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


<<winmail.dat>>

*****************************************************************************************
To view the terms under which this email is distributed, please go to 
http://www.hull.ac.uk/legal/email_disclaimer.html
*****************************************************************************************
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to