Poly Proxy: material_name

material_name
  • Returns the name of the polygon material.

Return Type:

  • string
  • Returns an empty string ("") if there isn't a polygon material.
    Sample Code

    ############################# get polygon material name

    # import bge
    import bge

    # get the current controller
    cont = bge.logic.getCurrentController()

    # get object that owns this controller
    obj = cont.owner
     
    # Get a list of the mesh
    meshList = obj.meshes

    # Get the first mesh on the object
    mesh = meshList[0]
     
    # get the first polygon on the mesh
    poly = mesh.getPolygon(0)

    # get the polygon material name
    polyMatName = poly.material_name