Hi,

I was wondering. I want to implement some picking, however I don't want to pick 
the entire scene graph. Just a sub-tree. 

I looked at osg::View::computeIntersections to try to replicate what it is 
doing. I have mimicked the code pretty much exactly, with one exception. 
Instead of having the camera accept the IntersectionVisitor, I have the root of 
my sub-tree accept it.

However, it doesn't seem to be working. The LineSegmentIntersector has zero 
intersections. However, if I switch to having the camera accept the 
IntersectionVisitor, then I get all of the intersections I'm expecting (and 
many that I don't want).

I tried a different approach: instead of having the sub-tree root accept the 
Visitor, have the camera accept it, since I know that works. However, give the 
root of my sub-tree a special nodemask so that the Visitor will affect it and 
ignore the others (the descendant nodes of this sub-tree root all have node 
masks of 0xffffffff so they will allow anything to traverse, but since the 
roots of the sub-trees that I'm interested in all have node masks of 0x1, this 
could work). The problem is, now I have to make sure that the _parents_ of 
these sub-tree roots all have this special bit set, which they don't, and 
managing that could be a pain.

I could just feed the Visitor to the camera, compute all intersections, and 
then try to suss out which node sub-trees were hit. This is sort of what I was 
doing before, but I found it to be a problem because our scene graph structure 
is not set up in a way that I can just look at a certain element in the 
NodePath to know what I hit. I write a fair amount of intelligence into it, and 
actually this is the way I _have_ been doing it, and I'm trying to move away 
from it because it's becoming unwieldy. I already have a list of the sub-tree 
roots that I care about, and I'd much rather just be able to ask one of these 
roots "Have you been picked?"

Does anyone have any suggestions? If so, that would be a huge help. Meanwhile, 
I keep plugging ahead and see what I find. Maybe the camera node is doing 
something to the IntersectionVisitor that I should know about? I'll take a look 
at that next.

Thank you!

Cheers,
Frank

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





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

Reply via email to