PandAI pursue vs pathfind, pathfinding with dynamically generated environment

Hi,

I’ve just started using Panda3d and I must say it’s amazing for now!
I have an issue with PandAI.
My game generates a dynamic environment (i.e. it’s randomly generated and then I use GeoMipTerrain - not sure this is the smartest way as most of the environment is made of simple walls or floor but it works for now). Then I have an actor, say the panda,that is meant to follow me without going through the walls.

I cannot use the pathfinding algorithm as it requires a fixed environment (one needs to pass the mesh file). I’ve tried using pursue but the panda keeps going through the walls (I suppose there are too many).

Is there a known solution to my problem? Otherwise is there somewhere that describes what the format of the mesh file is? I think I should be able to generate it quite easily using python considering I only have floor + some vertical walls.

Thanks a lot!

AI documentation involves creating a grid in 3D editors. However, a panda can very well generate a mesh on the fly. You will have to study the appropriate section.

https://docs.panda3d.org/1.10/python/programming/internal-structures/procedural-generation/creating-primitives.html?highlight=generate%20geom#creating-the-geomprimitive-objects

And develop a scene analysis algorithm.

Hum is there not a simpler way to directly generate the csv? Because right now I’m fine with using GeoMipTerrain to generate the scene.

Based on what data? , Theoretically, using a ray to collide with a territory, you can understand if this polygon is passable. Next, you need to use an algorithm similar to the CSV generator to create this file, but I did not think about it. I can’t say specific decisions about this, I need to look at what csv is.

Theoretically, this mechanism can be used.

addDynamicObstacle(NodePath obstacle);

But you need to think about it.

The data I am using is simple: it’s an orthogonal grid, where each cell of the grid is either floor or wall. So the data is basically a 2D array of 0 (floor) and 1 (wall). And I want the AI to only be able to navigate through cells which are of type floor. I’ll do a bit more research on the format of the csv, I’ll come back here if I find something more.

I wonder why this does not work for you?

https://docs.panda3d.org/1.10/python/programming/pandai/pathfinding/dynamic-obstacles

Oh yes, I get it, you’re doing minecraft. :slight_smile:

Of course, this is a second order question, but the panda supports named polygons, you can easily set a name based on the normal. This should help to generate the SVG file.