Vertex Proxy: setNormal

setNormal(nor)
  • Sets the normal vector of the vertex.

nor:

  • Type: float list [ nx, ny, nz]

nx:

  • cosine of the normal to the world x-axis
ny:
  • cosine of the normal to the world y-axis
nz:
  • cosine of the normal to the world z-axis
Sample Code

############################# set the normal vector of the vertex

# 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)

# normal vector
nor = [0.0, 0.0, -1.0]

# set the vertex normal vector
vert.setNormal(nor)