Collision Terrain

I’m having trouble getting any collisions to work with my terrain, I can only assume that the .egg is not created correctly. I tried doing a simple switch for RR’s terrain with my own and the script doesn’t recognize my terrain as a collision object. I’ve looked over the map’s details and can’t seem to find a problem with it.

<CoordinateSystem> { Y-Up }

<Comment> {
  "maya2egg2008 testLandscape.egg testLandscape.mb"
}
<Texture> phong1SG {
  "seamless_ground2048.jpg"
  <Scalar> format { rgb }
  <Scalar> wrapu { repeat }
  <Scalar> wrapv { repeat }
  <Scalar> minfilter { linear_mipmap_linear }
  <Scalar> magfilter { linear }
}
<Group> testLandscape {
  <Collide> { Polyset keep descend }
  <Dart> { 1 }
  <Group> GroundPlane {
    <Collide> { Polyset keep descend }
    <ObjectType> { none }
    <VertexPool> GroundPlaneShape.verts {
      <Vertex> 0 {
        -10 -2.22045e-015 10
        <UV> { 0 0 }
        <Normal> { 0 1 0 }
        <RGBA> { 1 1 1 1 }
      }
...
...
...

    <Polygon> {
      <Normal> { 0 1 0 }
      <TRef> { phong1SG }
      <VertexRef> { 108 109 120 119 <Ref> { GroundPlaneShape.verts } }
    }
  }
}

I converted the mb file using the mel GUI script, the terrain loads just fine in panda, it just isn’t recognized with the collision script.

Any ideas what I’m missing? Thanks.

The only thing I noticed is that you are setting polyset keep descend twice. From memory, doesn’t the descend tag automatically make all sub-groups inherit the same properties? I doubt this would stop the collisions working though…

RR’s terrain is named “terrain”.

Both are good points, but neither would stop a collision check from happening, whatever the results of that collision check, thanks for the replies though.

Does anyone know anything else that would prevent my terrain from registering as a collision object? I’ve seriously only changed one bit of code (well… two, including the node name condition)

self.environ = loader.loadModel("models/world")  
self.environ = loader.loadModel("models/testLandscape")  

The first one works just fine, and I can see the collisions as it recognizes them, the 2nd shows my landscape, textured, but no collisions.

So I just started deleting code in my terrain’s .egg file and apparently the line…

<Dart> { 1 }

was what was keeping the terrain from being recognized as a collision object. Why? I have no freaking clue, but hey, it works now. Just thought I’d post that in case anyone was wondering / was having that issue.

If anyone knows what this line’s purpose is or how it managed to get in there, I’d love to know. Would be helpful information for when creating much more expansive terrain that would take longer to sift through to debug after egg-ing.

Thanks again.

That flag indicates an animated model, and is only supposed to be written to the egg file if you specify “-a model” to the maya2egg command line. But it doesn’t look like you did that, so it’s a mystery to me how it got there.

David

That’s 1 of the “features” of the ETC’s MEL script. Use my mod in CodeSnippet and you’ll be just fine.