Gather vertex data from an egg [SOLVED]

Here’s a question that’s a bit more complicated than my usual. I’ve decided that I want to use an A* type AI system for moving characters. To do this, I plan on making a grid of points, each with two coordinates, that the characters can move between. The grid won’t necessarily be a perfect grid, I’ll need to shape it to the actual map.

I figured the easiest way to create this grid would be to make a model that’s just a bunch of vertices where I want the points to be, convert that to an egg, and read the vertex data from it to position the actual movement points.

I can’t use the model I’m using for the map, that wouldn’t be practical for the kind of movement paths I want to make.

I looked into the geometry manipulation stuff in the manual, and frankly, I’m very confused by it. I just want to get the vertices positions and use them to set variables in a custom class, then dump them. What is the best method to do this?

Use to load the egg file directly, instead of converting it to a model, then walk through the nodes via EggGroupNode.getFirstChild() / getNextChild() until you find the EggVertexPool, then walk through all of the vertices with getNumVertices()/getVertex(). All of these interfaces are explained in the API reference for the various egg structures.


I’m finally getting around to testing this today, so get ready for more questions spawned by my idiocy. :smiley:

A place to get started would be Treeform’s original eggoctree. There is code specifically to load an Egg and process vertices.

This is going pretty well so far. I’ve got the egg loading, and I stripped it of unnecessary groups to make getting to the children easier. I can get the vertex pool with just getFirstChild() now. Now I’m going to test extracting the vertex data and using it for other things.

I was able to extract the vertex position data without a problem. I’ve used a few different languages for programming games before, like java, flash actionscript 2.0, Virtools, basic, visual basic, and more. I did the art for a C++ game that used the open source engine irrlicht too. I have to say that without a doubt, Panda3D is the easiest to use engine I’ve worked with, and it never fails to surprise me with what it’s capable of.

Of course, a big part of that ease of use is thanks to the community here on these forums, particularly David (drwr), always answering my questions. Thanks again guys.

If’n ai meet ye on tha high seas, Ai’ll offer ye a spot in me crew, instead o’ keel haulin’ ye. :smiley: