Vertex Proxy: getNormal

getNormal()
  • Returns the normal vector of the vertex.

Return Type:

  • float List [ nx, ny, nz]

nx:

  • cosine of the normal to the world x-axis
  • Type:  float
ny:
  • cosine of the normal to the world y-axis
  • Type:  float
nz:
  • cosine of the normal to the world z-axis
  • Type:  float
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 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 vertex normal vector
normal = vert.getNormal()