Render: drawLine

drawLine(start, end, color)
  • draws a line for one frame.

start:

  • start point of the line
  • Type:  float List [ x, y, z]
  • x =  x world coordinate
  • y =  y world coordinate
  • z =  z world coordinate
end:
  • end point of the line
  • Type:  float List [ x, y, z]
  • x =  x world coordinate
  • y =  y world coordinate
  • z =  z world coordinate
color:
  • the color of the line
  • Type:  float List [ r, g, b]
  • r =  red color value
    Type: float
    Range: 0.00 to 1.00
  • g =  green color value
    Type: float
    Range: 0.00 to 1.00
  • b =  blue color value
    Type: float
    Range: 0.00 to 1.00
Sample Code

################  draw a line for one frame

 
# import bge module
import bge

# get the render module
rend = bge.render

# starting point
start = [ 1.0, 3.50, 2.0]

# end point
end = [ 5.0, 9.0, 2.0]

# color red
color = [ 1.0, 0.0, 0.0]

# draw a line
rend.drawLine(start, end, color)