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! navigation mesh


1 Answer 1


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
  • $\begingroup$ 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 ? $\endgroup$
    – sosoup
    Aug 10, 2015 at 11:04
  • $\begingroup$ Thank you so much !! Your answer helped me immensely. Thank you so so much. $\endgroup$
    – sosoup
    Aug 10, 2015 at 13:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .