Vertex Proxy: x

x
  • gets/sets the x position of the vertex using local coordinates (distance from the object center).

Type:

  • float number
Sample Code

############################# get the vertex local x 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)

# get local x position of the vertex
x_pos = vert.x

Sample Code

############################# set the local vertex x 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)

# set x position of the vertex
vert.x = 1.0