Object with two meshes? (Navmeshes)

The goal is to replace the mesh of a Navmesh with multiple other meshes. There is a rebuild() function, but it doesn’t seem to work. I’ve tried creating two meshes by hand and using rebuild() to rebuild the mesh of one based on the other (not sure it works like that…) So next it would seem I need to just replace the mesh of the Navmesh with the mesh I desire.

So, the real question is whether or not I can give an object two meshes. It seems the mesh list of all objects are read-only, and I can’t add a mesh to an object before it goes to the GE. Ideally, I’d be able to logically determine what surfaces I want to include in walkable space and then build a Navmesh based on that. I’m fairly certain I have a number of misconceptions, so bare with me, please.

import bge
import Rasterizer as rast
cont = bge.logic.getCurrentController()
owner = cont.owner
scene = bge.logic.getCurrentScene()
steering = cont.actuators[0]
steering.behavior = 3
steering.target = scene.objects[owner['target']]
steering.navmesh = scene.objects["MyNavMeshB"]
steering.velocity = 12

This script works. As you can tell from the image, I have two Navmeshes. The one on the left is MyNavMeshA, while the one on the right (selected) is MyNavMeshB. What I’d like is to be able to update my script with Navmesh data from MyNavMeshA, such that Navmesh data from both A and B are now included in the actor’s pathing.

I’ve been using this page <http://wiki.blender.org/index.php/User:Nicks/Gsoc2010/Docs#Path-finding_API_for_Blender_Game_Engine> during my testing. Gives you the methods associated with Navmesh objects.

EDIT Pathing Test
Keys: Space cycles through targets (A-B-C-D)
G: Adds and removes the gate at the southern end of the map
All red areas are unwalkable - the Navmesh was created by hand to follow walkable areas.
There is only 1 Navmesh (named MyNavMesh) in this example.

In this example you’ll see that it is not possible for the actor to account for a fully blocked off path. The navigation orders continually recycle, so there is no issue with updating the logic.

Navigation Types: Steering and Pathfinding
Steering will attempt to avoid objects labeled as Obstacles in the physics tab, while Pathfinding ignores Obstacles and just follows the path. To avoid obstacles in Pathfinding mode, the Navmesh must be created to account for them (ie - the walls in this example do not have any parts of the Navmesh in their space).

Ideally, we could split the Navmesh up into parts in the editor, and in real-time put the parts together as new areas become available.

Ok, you need one navmesh that is half the large navmesh, and the other that is both sections, and have both in the scene,

then use python to change to another navmesh,

Edit:Hrm, this does not seem to work… on pathfinding…

Spitting out a bunch of errors, after I close the map

I don’t think swap meshes on a navigation mesh works…

Maybe have a obstacle wall that is deleted opening the next part of the map?


ATaleOftwoNavMesh.blend (450 KB)

Objects can only be avoided using obstacle obstruction, which pretty much only works when you want to go around simple obstructions. Otherwise you have to have your Navmesh avoid the obstacles entirely. In the case where you have whole areas blocked off, I’d say utilizing varying sizes and complexities of Navmesh versions would work, but what if you have a map with lots and lots of initially inaccessible areas? Each new blocked off area increases the number of Navmesh versions reuired exponentially.

What about 1 large obstacle that blocks the blocked paths?

Updated my OP.