I have created a plane and I need to set the Physics Type of the object to NAVIGATION_MESH. I cant figure out, how I should do that. Below is the python script for generating this mesh and setting physics type but unfortunately its not working.
import bpy, mathutils def create_custom_mesh(objname): # Define arrays for holding data myvertex =  myfaces =  zcord = 11.83068 # Constant Z Coordinate # vertex 0 mypoint = [(-4.64863, -4.80997, zcord)] myvertex.extend(mypoint) # vertex 1 mypoint = [(-4.02263, -4.80997, zcord)] myvertex.extend(mypoint) # vertex 2 mypoint = [(-4.64863, -4.18397, zcord)] myvertex.extend(mypoint) # vertex 3 mypoint = [(-4.02263, -4.18397, zcord)] myvertex.extend(mypoint) myface = [(0, 1, 3, 2)] myfaces.extend(myface) # Create mesh data mymesh = bpy.data.meshes.new(objname) # Create object myobject = bpy.data.objects.new(objname, mymesh) # Link object to scene bpy.context.scene.objects.link(myobject) # Generate mesh data mymesh.from_pydata(myvertex, , myfaces) # Calculate the edges mymesh.update(calc_edges=True) return myobject create_custom_mesh("route_plane") bpy.data.objects['route_plane'].select = True bpy.data.objects['route_plane'].game.physics_type == 'NAVIGATION_MESH' print("---------------------------------------------")
What am I making wrong here, cause the object 'route_plane' gets created and being placed at the correct location in the scene but physics type is never set. I need to set the "Navigation Mesh" physics type on an existing object, like 'route_plane' (as in the above code). I can not generate the navigation mesh via the relevant button in the scene properties using GUI.
Please help me, thanks in advance !