Vertex Proxy: normal

normal
  • gets/sets the normal vector of the vertex.

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

############################# get 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 meshes
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 vertex normal vector
nor = vert.normal

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 meshes
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 vertex normal vector
vert.normal = [0.0, 0.0, 1.0]