This is my code:
def createNavMesh(self, mesh, gridWidth):
"""将生成的网格保存为.csv文件"""
file_object = open(sys.path[0]+"/navmesh.csv", "w")
try:
file_object.write("Grid Size,")
file_object.write(str(gridWidth))
file_object.write("\nNULL, NodeType, GridX, GridY, Length, Width, Height, PosX, PosY, PosZ")
for x in range(0,gridWidth):
for y in range(0,gridWidth):
file_object.write("\n1,")
file_object.write(str(mesh[y][x]))
file_object.write(",")
file_object.write(str(x))
file_object.write(",")
file_object.write(str(y))
file_object.write(",1,1,0,")
file_object.write(str(x))
file_object.write(",")
file_object.write(str(y))
file_object.write(",0")
finally:
file_object.close()
But this navmesh.csv can’t work.