Recently, I took it upon myself to reexpose the built-in PandAI (panda3d.ai) artificial intelligence system, now allowing for A* pathfinding over terrain, stairs, and arbitrary trimeshes. Visual examples can be found below. The full source repository is available here: https://github.com/rayanalysis/pandai-samples/
This work has involved writing a new navmesh generation routine, centered around the creation of:
- A PandAI navmesh initialization layer and
- (optional) a collision mesh for the built-in collision system from Blender or another loaded model which can interoperate with the navmesh initialization and the built-in collision system at the same time.
The new navmesh generation routine has been kept very minimal, primarily taking place in the EggPrimitiveCreation.py set of definitions. Fundamentally, this new routine allows a user of IE Blender 4.1 to directly export a level mesh to .glb and have it work immediately with PandAI, no converters or special flags necessary. The source provided with these new pandai-samples takes your input model (which may be .glb, gltf, or something else) and saves it to .bam right away, extracting by default “Plane.001” as the target geom (which is the Blender layer name).
The technical complexity of the 2D A* pathfinder, the navmesh initialization routine, the trimesh generator for the built-in collision system, and the various multi-character possibilities inherent with PandAI makes this a somewhat advanced use case. I’d be happy to field questions that may come up as more people make use of panda3d.ai and these new character AI sample programs.
I am open to PRs, feature requests, and as mentioned technical questions regarding how these sample programs work. I’d like to get at least one multi-Actor behavioral sample program completed as a next step.
Brief example gifs below from the sample programs: