Vertex Proxy: getXYZ

getXYZ()
  • Returns the X, Y and Z position of the vertex in local coordinates (distance from object center).

Return Type:

  • float list [ x, y, z]

x:

  • x distance from the object center (local coordinates).
y:
  • y distance from the object center (local coordinates).
z:
  • z distance from the object center (local coordinates).
Sample Code

############################# get the vertex local xyz position

# 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 meshes
meshList = obj.meshes

# Get the first mesh on the object
mesh = meshList[0]
 
# get the first vertex of the first material
vert  = mesh.getVertex( 0, 0)

# get local xyz position of the vertex
xyz_pos = vert.getXYZ()