Vertex Proxy: setXYZ

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

xyz_Pos:

  • 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 mesh
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)

# new xyz for the vertex
xyz_Pos = [2.0, 3.5, -1.8]

# set local xyz position of the vertex
vert.setXYZ(xyz_Pos)