Invisible geometry in egg

I would like to have multiple objects in an egg file, but some of them shouldn’t be rendered, because I’m using the data for intersection tests. I found this tag in the eggSyntax.txt document, but I’m having problems…

  <Scalar> visibility { hidden | normal }

    If the visibility of a primitive is set to "hidden", the primitive
    is not generated as a normally visible primitive.  If the
    Config.prc variable egg-suppress-hidden is set to true, the
    primitive is not converted at all; otherwise, it is converted as a
    "stashed" node.

    This, like the other rendering flags alpha, draw_order, and bin,
    may be specified at the group level, within the primitive level,
    or even within a texture.

Here is how I placed the tag in my egg file…

<Group> Cube.001 {
  <Scalar> visibility { hidden }
  <Tag> Intersect {  }
  <VertexPool> Cube.001 {
    <Vertex> 0 {
      1.000000 1.000000 -1.000000
    }
    <Vertex> 1 {
      1.000000 -1.000000 -1.000000
    }

but now I’m getting an error that only occurs when this tag is present.

Traceback (most recent call last):
  File "IntersectionTest.py", line 140, in <module>
    print i.check(fromObj,intoObj)
  File "IntersectionTest.py", line 85, in check
    vertices = self.getVertices(fromGeomNode)
  File "IntersectionTest.py", line 58, in getVertices
    for i in range(geomNode.getNumGeoms()):
AttributeError: 'libpanda.NodePath' object has no attribute 'getNumGeoms'

Am I even going about this the right way, or is there something simpler? :confused:
I thought of just using the collide tag, but I don’t want it to conflict with Panda’s collisions.

The error message is so clear. geomNode is not a GeomNode, but a NodePath. Use geomNode.node() to get the node it points to.

sorry- I’ll admit my question is a little too lengthy. Really, I am just looking for a way to specify whether or not the geometry is rendered in the egg file, if it is even possible.

Well, you found it. The “hidden” scalar does exactly that. So what other question do you have? It sounds like your other question is why are you getting the above exception, which it seems to me that ynjh_jo has answered satisfactorily.

You do mention that you want the geometry to be hidden because you are using it only for intersection tests. If by that you mean you are using Panda’s collision system with it, then you don’t need to mess with the “hidden” flag, because the normal collision tags change the geometry from a GeomNode, which is optimized for rendering, into a CollisionNode, which is optimized for collision tests (and isn’t rendered at all).

David

My bad… :blush:
It looks like the hidden tag is working… so really, ynjh_jo’s comment is actually pretty helpful. It seems that by using that the ‘hidden’ tag, the GeomNode changes to a PandaNode, as I found out with .ls()…
I wasn’t expecting this to happen, so now I’m thinking it would be much easier to just setOverallHidden(True) on GeomNodes with the tag I specify instead of messing with the egg file.
Thank You! :smiley: