Mesh Proxy: getPolygon

getPolygon(polyID)
  • Returns the polygon object.

Return Type:

  • KX_PolyProxy

polyID:
  • Type: integer
  • 0 = first polygon on the mesh
  • 1 = second polygon on the mesh
  • 2 = third polygon on the mesh
  • etc.
    Sample Code

    ############################# get the polygon

    # 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]
     
    # 1st polygon is polyID = 0
    polyID = 0

    # get the first polygon on the mesh
    poly = mesh.getPolygon(polyID)