Skip to content

KX_VertexProxy

Base class: SCA_IObject

A vertex holds position, UV, color and normal information.

Note: The physics simulation is NOT currently updated - physics will not respond to changes in the vertex position.

The position of the vertex.

Type: Vector((x, y, z))

The texture coordinates of the vertex.

Type: Vector((u, v))

The texture coordinates list of the vertex.

Type: list of Vector((u, v))

The normal of the vertex.

Type: Vector((nx, ny, nz))

The tangent of the vertex (read-only), computed from the UV map used by the material’s Normal Map or Tangent node (the active UV map by default). The w component holds the bitangent sign.

Type: Vector((tx, ty, tz, w))

The color of the vertex.

Type: Vector((r, g, b, a))

Black = [0.0, 0.0, 0.0, 1.0], White = [1.0, 1.0, 1.0, 1.0]

The color list of the vertex.

Type: list of Vector((r, g, b, a))

The x coordinate of the vertex.

Type: float

The y coordinate of the vertex.

Type: float

The z coordinate of the vertex.

Type: float

The u texture coordinate of the vertex.

Type: float

The v texture coordinate of the vertex.

Type: float

The second u texture coordinate of the vertex.

Type: float

The second v texture coordinate of the vertex.

Type: float

The red component of the vertex color. 0.0 <= r <= 1.0.

Type: float

The green component of the vertex color. 0.0 <= g <= 1.0.

Type: float

The blue component of the vertex color. 0.0 <= b <= 1.0.

Type: float

The alpha component of the vertex color. 0.0 <= a <= 1.0.

Type: float

Gets the position of this vertex.

Returns: this vertexes position in local coordinates.

Return type: Vector((x, y, z))

Sets the position of this vertex.

Type: Vector((x, y, z))

  • pos: the new position for this vertex in local coordinates.

Gets the UV (texture) coordinates of this vertex.

Returns: this vertexes UV (texture) coordinates.

Return type: Vector((u, v))

Sets the UV (texture) coordinates of this vertex.

Type: Vector((u, v))

Gets the 2nd UV (texture) coordinates of this vertex.

Returns: this vertexes UV (texture) coordinates.

Return type: Vector((u, v))

Sets the 2nd UV (texture) coordinates of this vertex.

Type: Vector((u, v))

  • unit: optional argument, FLAT==1, SECOND_UV==2, defaults to SECOND_UV
  • unit: integer

Gets the color of this vertex.

The color is represented as four bytes packed into an integer value. The color is packed as RGBA.

Since Python offers no way to get each byte without shifting, you must use the struct module to access color in an machine independent way.

Because of this, it is suggested you use the r, g, b and a attributes or the color attribute instead.

import struct;
col = struct.unpack('4B', struct.pack('I', v.getRGBA()))
# col = (r, g, b, a)
# black = ( 0, 0, 0, 255)
# white = (255, 255, 255, 255)

Returns: packed color. 4 byte integer with one byte per color channel in RGBA format.

Return type: integer

Sets the color of this vertex.

See getRGBA() for the format of col, and its relevant problems. Use the r, g, b and a attributes or the color attribute instead.

setRGBA() also accepts a four component list as argument col. The list represents the color as [r, g, b, a] with black = [0.0, 0.0, 0.0, 1.0] and white = [1.0, 1.0, 1.0, 1.0]

v.setRGBA(0xff0000ff) # Red
v.setRGBA(0xff00ff00) # Green on little endian, transparent purple on big endian
v.setRGBA([1.0, 0.0, 0.0, 1.0]) # Red
v.setRGBA([0.0, 1.0, 0.0, 1.0]) # Green on all platforms.
  • col: the new color of this vertex in packed RGBA format.
    • type: integer or list [r, g, b, a]

Gets the normal vector of this vertex.

Returns: normalized normal vector.

Return type: Vector((nx, ny, nz))

Sets the normal vector of this vertex.

Type: sequence of floats [r, g, b]

  • normal: the new normal of this vertex.