KX_VertexProxy(SCA_IObject)
base class — SCA_IObject
- class bge.types.KX_VertexProxy
A vertex holds position, UV, color and normal information. You can only read the vertex properties of a mesh object. In upbge 0.3+, KX_MeshProxy, KX_PolyProxy, and KX_VertexProxy are only a representation of the physics shape as it was when it was converted in BL_DataConversion. Previously this kind of meshes were used both for render and physics, but since 0.3+, it is only useful in limited cases. In most cases, bpy API should be used instead.
Note: The physics simulation doesn’t currently update KX_Mesh/Poly/VertexProxy.
- normal
The normal of the vertex.
- Type
Vector((nx, ny, nz))
- color
The color of the vertex.
Black = [0.0, 0.0, 0.0, 1.0], White = [1.0, 1.0, 1.0, 1.0]
- x
The x coordinate of the vertex.
- Type
float
- y
The y coordinate of the vertex.
- Type
float
- z
The z coordinate of the vertex.
- Type
float
- u
The u texture coordinate of the vertex.
- Type
float
- v
The v texture coordinate of the vertex.
- Type
float
- u2
The second u texture coordinate of the vertex.
- Type
float
- v2
The second v texture coordinate of the vertex.
- Type
float
- r
The red component of the vertex color. 0.0 <= r <= 1.0.
- Type
float
- g
The green component of the vertex color. 0.0 <= g <= 1.0.
- Type
float
- b
The blue component of the vertex color. 0.0 <= b <= 1.0.
- Type
float
- a
The alpha component of the vertex color. 0.0 <= a <= 1.0.
- Type
float
- getXYZ()
Gets the position of this vertex.
- getUV()
Gets the UV (texture) coordinates of this vertex.
- getUV2()
Gets the 2nd UV (texture) coordinates of this vertex.
- getRGBA()
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
- getNormal()
Gets the normal vector of this vertex.
- Returns
normalized normal vector.
- Return type
Vector((nx, ny, nz))