After spending some hours in reading the documentation of PandAI, especially the part of Pathfinding, I’m not sure how I should use PandAI. In my case, there isn’t a map made in Blender or something like that, I have small tiles (which are created in Blender). This tiles I put together to a map, similar to a chess board, but with columns and walls. An small example:
Is it possible (and smart) to make an in-memory-model, maybe with a cardmaker (sounds easy?), to generate a dummy map where the accessible tiles are and process it with the pythonMeshGen? I have to modify it a bit, but I think it should be possible. The bad thing is, everything is hardcoded because the tileset itself doesn’t know wether it is accessible or not. If this is a possible way, should I subdivide the tiles in the dummy map?
And there is another question: has the map to be centered around the origin? My tilemap isn’t centered and is not intended to be. The coordinate origin (0, 0, 0) is behind the edge on my screenshot, at floor level.
So, after more and more hours reading, I jumped into the water (and failed totally, I’m still under water).
Here is my adventure:
I have a small level for testing purposes. I wrote it to disc (as a .bam), converted it to .egg, converted this egg to .dxf
Finally I could import this into Blender and (after some hours spending the “Build navigation mesh” function, which doesn’t work in my case) made an navigation mesh by hand. Exported this to .egg, tried the Blender MeshGen… and got an error, don’t know where it comes from. Look this:
joern@joern-Satellite-A100:~/Downloads/pythonMeshGen$ python BlenderMeshGen.py level.egg navmesh.egg
DirectStart: Starting the game.
Known pipe types:
glxGraphicsPipe
(all display modules loaded.)
AL lib: pulseaudio.c:612: Context did not connect: Zugriff verweigert
Creating full node list...
Assertion failed: index >= 0 && index < (int)size() at line 467 of built/include/eggPrimitive.I
Traceback (most recent call last):
File "BlenderMeshGen.py", line 300, in <module>
app = MyApp()
File "BlenderMeshGen.py", line 48, in __init__
self.iterateEggPoly(self.egg, "Full")
File "BlenderMeshGen.py", line 95, in iterateEggPoly
self.iterateEggPoly(child, type)
File "BlenderMeshGen.py", line 95, in iterateEggPoly
self.iterateEggPoly(child, type)
File "BlenderMeshGen.py", line 95, in iterateEggPoly
self.iterateEggPoly(child, type)
File "BlenderMeshGen.py", line 95, in iterateEggPoly
self.iterateEggPoly(child, type)
File "BlenderMeshGen.py", line 95, in iterateEggPoly
self.iterateEggPoly(child, type)
File "BlenderMeshGen.py", line 72, in iterateEggPoly
egg.getVertex(2), egg.getVertex(3))
AssertionError: index >= 0 && index < (int)size() at line 467 of built/include/eggPrimitive.I
I think PandAI requires a very specific way the vertices are ordered. I’m not certain, though, but this was the reason that models generated by Blender did not initially work with PandAI, since the triangles were in the wrong order. (IIRC they ended up having a separate converter script for blender).
From what I can tell about the specific error, that part of the script is expecting a quad when it’s getting a triangle.
Unfortunately my PC was broken, so I hadn’t the possibility to work further on my problem. I decided to create my navigation mesh on my own and implement the A* algorithm for it (hoping it will be fast enough).
Now I have an very small issue, but I am not able to find the error. For simplicity, I want to display the triangles I generate for my NavMesh with different colors on the corners. Here is my code:
The triangles are there, but they are white and there isn’t any transparency (of course I have set the Transparency to TransparencyAttrib.MAlpha). Thank you for your time!