Vertex Painting Ground MeshesWhile I'm waiting for some feedback on the logic of my pinBone extension to the Blender source, I've decided to dig back into the BlenderPeople code itself.
I've just added support for vertex-painted Ground objects. Here's what it will do:
BlenderPeople checks the vertex colored red channel of an Actor's current location on the Mesh. The red channel is used to determine "travelability." Full painted Red (the default vert color for that channel, as it defaults to white overall) is the most travelable color. Black means that the area is impassable. So, you could give your entire battlefield a midlevel red color, then give preferred paths a brighter red, and give areas of the mesh corresponding to walls or pits or boulders a black color. Actors will attempt to route around dead areas.
It is NOT a full-on pathfinding solution
a la A*. It does not look ahead very far. But that is kind of what BlenderPeople is about - generating good looking crowd/battle sims without a lot of statewise overhead. I've run some sims on paper, and I'm thinking it will work very well. Of course, the true test will be when I pop it into the code and watch a real animation. And thanks to LetterRip for pointing me to the article that gave me the inspiration for this system.
Vertex color information is stored with vert location information in the database tree, so dynamic modifications to the passability of the mesh can be altered over the course of the simulation, if we so desire later on. Want to keep the modifications? Just don't rebuild your ground tree. Want to ditch them? Rebuild it. Easy enough.
I have the data structures built for it, and have the vert color analyses working fine. Now I just have to add a couple of checks into the pathfinding section of the movement code. It's a very simple algorithm and shouldn't take long. I'll make another post when it's in and working. A day or two later, I'll follow up with an animation.