Vertex Proxy: r

r
  • gets/sets the red color channel of the vertex.

Type:

  • float number
  • Range: 0.0 to 1.0
Sample Code

############################# get the vertex red color channel

# 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 the red color channel (RGBA)
rColor = vert.r

Sample Code

############################# set the vertex red color channel

# 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 the red color channel (RGBA)
vert.r = 1.0