# LineNodePath

These questions of mine seem silly, but I don’t know how else to go about getting them answered…

How does LineNodePath work? None of the methods are documented in its class page, and this is what I came up with. It draws a single line across the middle of the screen, and testing has shown that this line is from both the p2-p3 line and p4-p1 line (they are on top of each other).

``````from pandac.PandaModules import *
from direct.directtools.DirectGeometry import LineNodePath
import direct.directbase.DirectStart

l = LineNodePath(render2d,'box',4,VBase4(1,0,0,1))
p1 = (-.5,-.5,0)
p2 = (-.5,.5,0)
p3 = (.5,.5,0)
p4 = (.5,-.5,0)
l.drawLines([[p1,p2],[p2,p3],[p3,p4],[p4,p1]])
l.create()
run()``````

``l.drawLines([[p1,p2],[p2,p3],[p3,p4],[p4,p1]])``

will draw a line from p1 to p2, then from p2 to p3, then from p3 to p4, and then from p4 to p1. You could have achieved the same thing with less effort using:

``l.drawLines([[p1,p2,p3,p4,p1]])``

The reason that you only see a single line instead of a box is that you have aligned your points in the X-Y plane, but render2d is aligned in the X-Z plane, so you are looking at your box edge-on. Maybe you meant to define your points like this instead:

``````p1 = (-.5,0,-.5)
p2 = (-.5,0,.5)
p3 = (.5,0,.5)
p4 = (.5,0,-.5)``````

David