[osg-users] Only intersecting certain nodes in the scene graph
jean-sebastien.guay at cm-labs.com
Thu Jul 3 10:37:50 PDT 2008
> I created a node mask for the terrain, 0x1, and used setNodeMask to set
> it on the root node of the terrain database.
> I am using the computeIntersections function of Viewer and passed along
> that traversal mask hoping that it would only intersect the paged
> database. However, the computeIntersections function is computing
> intersections against all of the nodes in the scene graph instead of
> just the paged database.
The default node mask is 0xFFFFFFFF, and you don't mention if you set
the node mask on your text items (or other objects) to something else.
No matter what the traversal mask is you give to computeIntersections,
it will return true when ANDed with 0xFFFFFFFF...
You can for example set your terrain's mask to 0x1, and your GUI
elements or other things to 0x2, and then give 0x1 as the traversal mask
in computeIntersections, and it will only intersect with the terrain.
I generally reserve one bit of the nodemask to items that are pickable,
I find that makes comprehension simpler. Then I just have to make sure
to set each object's nodemask appropriately at creation.
Hope this helps,
Jean-Sebastien Guay jean-sebastien.guay at cm-labs.com
More information about the osg-users