How to store CollisionSegment in an egg file? Or BUG?

I looked through the documination but did not find it
So i tried to write my own and wala bug or missing feature!

import  os
from pandac.PandaModules import *
np = NodePath('a')
cs = CollisionSegment()
cs.setPointA(Point3(0,0,0))
cs.setPointA(Point3(0,1,0))
cNode = CollisionNode('col-t')
cNode.addSolid(cs)
np.attachNewNode(cNode)
np.writeBamFile('testseg.bam')
os.system("bam2egg testseg.bam")

output :

testseg.bam : Bam version 6.15
<CoordinateSystem> { Z-Up }

<Comment> {
  "bam2egg testseg.bam"
}   
<Group> a {
  <Group> col-t {
    <ObjectType> { backstage }
  }
}

and finally

Now i am confused so i write my won egg on how it should be:

<CoordinateSystem> { Z-Up }

<Comment> {
  "bam2egg testseg.bam"
}

<VertexPool> Cube {
  <Vertex> 0 {
    0 0 0 
  }
  <Vertex> 1 {
    1 1 1 
  } 
}
<Group> a {
  <Group> col-t {
    <ObjectType> { barrier }
    <Line> {
      <VertexRef> { 0 1 <Ref> { Cube } }
    }
  }
}

And i get a seg fault. Is this a bug?

NOTE: i am trying to create a collision wire frame made out of segments so that i could collide it to collision thing made out of polygons so that i can have polygon to polygon collisions.

From Collision Solids in the manual:

So there’s not much point in reading a CollisionSegment out of an egg file, since it won’t be useful for the purpose you have in mind anyway. This is why we never bothered to implemented storing such a thing in an egg or bam file.

As to the segment fault, well, it’s a bug in the sense that it should have failed more gracefully than that. But that’s a very minor bug, in my mind, since it wouldn’t have done what you wanted anyway.

David

Oh, sorry, now that I’m re-reading your post I see that this is not what you have in mind. You want to simulate a polygon out of CollisionSegments, for the purpose of creating a “from” object.

This is technically doable, except for the fact that we don’t support CollisionSegments in egg files. You’d have to read the egg file yourself via the egg library and construct the CollisionSegments by hand.

It sounds like a terrible idea, though. The performance would be absolutely horrible.

David

Well this is for my star city game. It will not be real time i just need to make sure that a building does not over lap with another building - the collision routine will only run when player finishes moving or rotating the building. Buildings are relatively low poly about 150 polygons. So i think i can test 150x150 collisions of primitive per second. Maybe the egg-octreefy.egg script i made will help.

Do you have a better idea of doing polygon to polygon collisions?

Well, hmm. You can go ahead and construct the CollisionSegments yourself, either by reading the egg file, or by reading and decoding the Geom. For the purpose you describe, it might not be that bad.

Other than that, it might be time to integrate with a third-party collision library such as the one provided with ODE.

David