Here is a simple line
#!/usr/bin/env python3
from direct.showbase.ShowBase import ShowBase
from panda3d.core import LineSegs
class MyApp(ShowBase):
def __init__(self):
ShowBase.__init__(self)
# Set up the camera
self.setup_camera()
# Create a LineSegs object
lines = LineSegs()
# Set the color of the line (red)
lines.set_color(1, 0, 0, 1)
# Define the starting and ending points of the line
start_point = (0, 0, 0)
end_point = (1, 0, 0)
# Draw the line
lines.move_to(start_point)
lines.draw_to(end_point)
# Create a NodePath to attach the line geometry
line_np = self.render.attachNewNode(lines.create())
# Set the line thickness
line_np.setRenderModeThickness(3)
def setup_camera(self):
self.disableMouse()
camera.setPos(0, -10, 0)
camera.lookAt(0, 0, 0)
app = MyApp()
app.run()