# How get length of Navigation Mesh?

I have a navigation mesh (as shown in the attached picture). The navigation mesh consists of curve and array modifiers. As it is has an array modifier, it consists of strings of planes (I see it when I switch to 'edit mode').

My question is, can I iterate over the navigation mesh to get its the length and coordinate of center of each small planes in the navigation mesh. If yes then, please give me some python based example. Thanks in advance!

Since each of the small planes are the faces of the mesh, iterating through the polygons on the object mesh data provides access to the coordinates of the center of the face. Then using two consecutive coordinates, the distance between the centers can be calculated. This approach assumes the previous face is adjacent to the current face. Additionally, because accessing mesh data uses bpy, any changes will not occur while the game engine is running.

import bpy, mathutils

plane = bpy.data.objects["Plane"]

previous = None

for poly in plane.data.polygons:
center = mathutils.Vector(poly.center)

if previous:
previous -= center
#print length and center
print(previous.length, center)

previous = center

• Thank you so much for your effort. I tried this code and it works like a charm. But i have a further question, I am running blender for my robot simulation. The simulator is called MORSE which uses the blender game engine. Is there a way, to obtain the similar result (as in the above script), in the blender game engine ? Aug 10 '15 at 11:04
• Thank you so much !! Your answer helped me immensely. Thank you so so much. Aug 10 '15 at 13:41