Here’s my A* Pathfinding demo.
Basically, here’s what goes down:
You click to set a destination marker, which the little red guy will quickly pathfind around blue obstacles to get to. The pathfinder is 3D capable, so there are a couple obstacles that you can tell the little red guy to go on top of (there’s a picture of this below). You can now also rotate the camera with arrow keys to help get a perspective on the 3D stuff.
Below the images there’s a quotebox with more detailed information about the pathfinder. Also, the scripts are very well commented, so you might have a chance at figuring out what’s what. You can use any part of this demo in any way you want.
>> Pathfinder3.blend.zip (Right-Click, Save-As)
Images so you know what you’re getting into:
(This isn’t a quote at all, I’m just using this quotebox to separate this information from the rest of the post)
Alright, so basically, the pathfinder object finds a path given a starting position, target position, and a list of node objects. This list of node objects is generated (once at the beginning of the scene) from what I call a “nodemesh string”. A nodemesh string is a big string of information that is generated based on the vertices and edges of a mesh called the nodemesh. The script that generates the nodemesh string information is called the “nodemeshCompiler”, and it is a blender script.
I’m getting the feeling that you are very confused about this.
I guess you could say that it consists of three primary components:
- The Pathfinder
- The Path Follower
- The Nodemesh Stuff
So, in order to change the obstacle layout, you need to:
1) Change the obstacle layout.
2) Change the nodemesh (on layer 3) to match your layout.
3) Generate the nodemesh information with nodemeshCompiler.py (press ALT+P in it’s window).
4) Copy and paste the information from the console (new: or from the file “NODEMESH.txt” that the script saved to your computer when you weren’t looking), to the “nodemesh” variable in “slab.py”.
Alright, well, I’m sure some of you might have a very vague idea of what is going on, and that the vast majority of you are completely confused.
Either way, the file itself contains more information that may help.
If you’ve got any question or comments or whatever, post them here.