Class KX_PolyProxy (2.48)


Methods
getMaterial getTextureName
getMaterialIndex getVertexIndex
getMaterialName isCollider
getMesh isVisible
getNumVertex ----------
 
Variables
collide v1
material v2
matid v3
matname v4
texture visible
 
Constants
---------- ----------

Inherited Methods:  Class PyObjectPlus
isA ----------

Inherited Methods:  Class Value
getName ----------



Methods



getMaterial

getMaterial()

Returns the polygon material.

Return Type:  KX_PolygonMaterial
or
KX_BlenderMaterial

Sample Code

# get controller
controller = GameLogic.getCurrentController()

# get object the controller is attached to
owner = controller.getOwner()

# get the mesh
mesh = owner.getMesh()
# get the first polygon on the mesh
poly = mesh.getPolygon(0)

# get the polygon material
polyMat = poly.getMaterial()

getMaterialIndex

getMaterialIndex()

Returns the material index of the polygon.
       
Return Type:  integer

Note:
Used with getVertexIndex to retrieve the vertex proxy (KX_MeshProxy).

Sample Code

# get controller
controller = GameLogic.getCurrentController()

# get object the controller is attached to
owner = controller.getOwner()

# get the mesh
mesh = owner.getMesh()
# get the first polygon on the mesh
poly = mesh.getPolygon(0)

# get the polygon material index
polyMatIndex = poly.getMaterialIndex()

getMaterialName

getMaterialName()

Returns the name of the polygon material

Return Type:  string

Sample Code

# get controller
controller = GameLogic.getCurrentController()

# get object the controller is attached to
owner = controller.getOwner()

# get the mesh
mesh = owner.getMesh()
# get the first polygon on the mesh
poly = mesh.getPolygon(0)

# get the polygon material name
polyMatName = poly.getMaterialName()

getMesh

getMesh()

Returns a mesh proxy
       
Return Type:  KX_MeshProxy

Sample Code

# get controller
controller = GameLogic.getCurrentController()

# get object the controller is attached to
owner = controller.getOwner()

# get the mesh
mesh = owner.getMesh()
# get the first polygon on the mesh
poly = mesh.getPolygon(0)

# get the mesh
polyMesh = poly.getMesh()

getNumVertex

getNumVertex()

Returns the number of vertex that make up the polygon.

Return Type:  integer

Sample Code

# get controller
controller = GameLogic.getCurrentController()

# get object the controller is attached to
owner = controller.getOwner()

# get the mesh
mesh = owner.getMesh()
# get the first polygon on the mesh
poly = mesh.getPolygon(0)

# get the number of vertex
numVerts = poly.getNumVertex()

getTextureName

getTextureName()

Returns the name of the polygon texture.
       
Return Type:  string

Sample Code

# get controller
controller = GameLogic.getCurrentController()

# get object the controller is attached to
owner = controller.getOwner()

# get the mesh
mesh = owner.getMesh()
# get the first polygon on the mesh
poly = mesh.getPolygon(0)

# get the polygon texture name
name = poly.getTextureName()

getVertexIndex

getVertexIndex(vert)

Returns the Mesh Vertex index number of a Polygon Vertex.

Return Type:  integer

vert:
Type:  integer
Range:  0 - 3

Note:
Used with getMaterialIndex to retrieve the vertex proxy (KX_MeshProxy).

Sample Code

# get controller
controller = GameLogic.getCurrentController()

# get object the controller is attached to
owner = controller.getOwner()

# get the mesh
mesh = owner.getMesh()
# get the first polygon on the mesh
poly = mesh.getPolygon(0)

# get the mesh vertex index 
vertIndex = poly.getVertexIndex(0)

isCollider

isCollider()

Returns whether or not the polygon will detect collisions.
       
Return Type:  integer

1 = detect collisions
0 = doesn't detect collisions

Sample Code

# get controller
controller = GameLogic.getCurrentController()

# get object the controller is attached to
owner = controller.getOwner()

# get the mesh
mesh = owner.getMesh()
# get the first polygon on the mesh
poly = mesh.getPolygon(0)

# collision turned on?
collisionOn = poly.isCollider()

isVisible

isVisible()

Returns whether or the not the polygon is visible.

Return Type:  integer

1 = visible
0 = invisible

Sample Code

# get controller
controller = GameLogic.getCurrentController()

# get object the controller is attached to
owner = controller.getOwner()

# get the mesh
mesh = owner.getMesh()
# get the first polygon on the mesh
poly = mesh.getPolygon(0)

# polygon visible?
polyVis = poly.isVisible()


Variables



collide

collide

Returns whether or not the polygon will detect collisions.
       
Return Type:  integer

1 = detect collisions
0 = don't detect collisions

Sample Code

# get controller
controller = GameLogic.getCurrentController()

# get object the controller is attached to
owner = controller.getOwner()

# get the mesh
mesh = owner.getMesh()
# get the first polygon on the mesh
poly = mesh.getPolygon(0)

# collision turned on?
collisionOn = poly.collide

material

material

Returns the polygon material.

Return Type:  KX_PolygonMaterial
or
KX_BlenderMaterial

Sample Code

# get controller
controller = GameLogic.getCurrentController()

# get object the controller is attached to
owner = controller.getOwner()

# get the mesh
mesh = owner.getMesh()
# get the first polygon on the mesh
poly = mesh.getPolygon(0)

# get the polygon material
polyMat = poly.material

matid

matid

Returns the material index of the polygon.
       
Return Type:  integer

Note:
Used with getVertexIndex to retrieve the vertex proxy (KX_MeshProxy).

Sample Code

# get controller
controller = GameLogic.getCurrentController()

# get object the controller is attached to
owner = controller.getOwner()

# get the mesh
mesh = owner.getMesh()
# get the first polygon on the mesh
poly = mesh.getPolygon(0)

# get the polygon material index
polyMatIndex = poly.matid

matname

matname

Returns the name of the polygon material

Return Type:  string

Sample Code

# get controller
controller = GameLogic.getCurrentController()

# get object the controller is attached to
owner = controller.getOwner()

# get the mesh
mesh = owner.getMesh()
# get the first polygon on the mesh
poly = mesh.getPolygon(0)

# get the polygon material name
polyMatName = poly.matname

texture

texture

Returns the name of the polygon texture.
       
Return Type:  string

Sample Code

# get controller
controller = GameLogic.getCurrentController()

# get object the controller is attached to
owner = controller.getOwner()

# get the mesh
mesh = owner.getMesh()
# get the first polygon on the mesh
poly = mesh.getPolygon(0)

# get the polygon texture name
name = poly.texture

v1

v1

Returns the Mesh Vertex index number of the 1st Polygon Vertex.

Return Type:  integer

Note:
Used with getMaterialIndex to retrieve the vertex proxy (KX_MeshProxy).

Sample Code

# get controller
controller = GameLogic.getCurrentController()

# get object the controller is attached to
owner = controller.getOwner()

# get the mesh
mesh = owner.getMesh()
# get the first polygon on the mesh
poly = mesh.getPolygon(0)

# get the mesh vertex index of the 1st poly vertex
vertIndex = poly.v1

v2

v2

Returns the Mesh Vertex index number of the 2nd Polygon Vertex.

Return Type:  integer

Note:
Used with getMaterialIndex to retrieve the vertex proxy (KX_MeshProxy).

Sample Code

# get controller
controller = GameLogic.getCurrentController()

# get object the controller is attached to
owner = controller.getOwner()

# get the mesh
mesh = owner.getMesh()
# get the first polygon on the mesh
poly = mesh.getPolygon(0)

# get the mesh vertex index of the 2nd poly vertex
vertIndex = poly.v2

v3

v3

Returns the Mesh Vertex index number of the 3rd Polygon Vertex.

Return Type:  integer

Note:
Used with getMaterialIndex to retrieve the vertex proxy (KX_MeshProxy).

Sample Code

# get controller
controller = GameLogic.getCurrentController()

# get object the controller is attached to
owner = controller.getOwner()

# get the mesh
mesh = owner.getMesh()
# get the first polygon on the mesh
poly = mesh.getPolygon(0)

# get the mesh vertex index of the 3rd poly vertex
vertIndex = poly.v3

v4

v4

Returns the Mesh Vertex index number of the 4th Polygon Vertex.

Return Type:  integer

Note:
Used with getMaterialIndex to retrieve the vertex proxy (KX_MeshProxy).

Sample Code

# get controller
controller = GameLogic.getCurrentController()

# get object the controller is attached to
owner = controller.getOwner()

# get the mesh
mesh = owner.getMesh()
# get the first polygon on the mesh
poly = mesh.getPolygon(0)

# get the mesh vertex index of the 4th poly vertex
vertIndex = poly.v4

visible

visible

Returns whether or the not the polygon is visible.

Return Type:  integer

1 = visible
0 = invisible

Sample Code

# get controller
controller = GameLogic.getCurrentController()

# get object the controller is attached to
owner = controller.getOwner()

# get the mesh
mesh = owner.getMesh()
# get the first polygon on the mesh
poly = mesh.getPolygon(0)

# polygon visible?
polyVis = poly.visible



Blender 3D
Game Engine